mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added type definitions for amap-js-api-map3d
This commit is contained in:
parent
706d838bd3
commit
9bff39ea19
489
types/amap-js-api-map3d/amap-js-api-map3d-tests.ts
Normal file
489
types/amap-js-api-map3d/amap-js-api-map3d-tests.ts
Normal file
@ -0,0 +1,489 @@
|
||||
/**
|
||||
* preset.ts
|
||||
*/
|
||||
|
||||
declare const map: AMap.Map;
|
||||
declare const lnglat: AMap.LngLat;
|
||||
declare const size: AMap.Size;
|
||||
declare const lnglatTuple: [number, number];
|
||||
declare const pixel: AMap.Pixel;
|
||||
declare const layer: AMap.Layer;
|
||||
declare const ambientLight: AMap.Lights.AmbientLight;
|
||||
declare const directionLight: AMap.Lights.DirectionLight;
|
||||
declare const line: AMap.Object3D.Line;
|
||||
declare const mesh: AMap.Object3D.Mesh;
|
||||
declare const object3d: AMap.Object3D;
|
||||
declare const geometry: AMap.Geometry3D.Mesh;
|
||||
|
||||
/**
|
||||
* lights.ts
|
||||
*/
|
||||
|
||||
// $ExpectType AmbientLight
|
||||
const testAmbientLight = new AMap.Lights.AmbientLight([0.1, 0, 0.1], 1);
|
||||
|
||||
// $ExpectType void
|
||||
testAmbientLight.setColor([0.1, 1, 0.5]);
|
||||
|
||||
// $ExpectType void
|
||||
testAmbientLight.setIntensity(1);
|
||||
|
||||
// $ExpectType DirectionLight
|
||||
const testDirectionLight = new AMap.Lights.DirectionLight([1, 2, 3], [1, 2, 3], 1);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setColor([1, 2, 3]);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setIntensity(1);
|
||||
|
||||
// $ExpectType void
|
||||
testDirectionLight.setDirection([1, 2, 3]);
|
||||
|
||||
/**
|
||||
* map3d.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DResult | null
|
||||
map.getObject3DByContainerPos(pixel);
|
||||
|
||||
// $ExpectType Object3DResult | null
|
||||
const containserPos = map.getObject3DByContainerPos(pixel, [layer], true);
|
||||
if (containserPos) {
|
||||
// $ExpectType number
|
||||
containserPos.index;
|
||||
// $ExpectType Vector3
|
||||
containserPos.point;
|
||||
// $ExpectType number
|
||||
containserPos.distance;
|
||||
// $ExpectType Object3D
|
||||
containserPos.object;
|
||||
} else {
|
||||
// $ExpectType null
|
||||
containserPos;
|
||||
}
|
||||
|
||||
map.AmbientLight = ambientLight;
|
||||
map.AmbientLight = undefined;
|
||||
|
||||
map.DirectionLight = directionLight;
|
||||
map.DirectionLight = undefined;
|
||||
|
||||
/**
|
||||
* object3d-group.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DGroup<Object3D>
|
||||
const testObject3dGroup1 = new AMap.Object3DGroup();
|
||||
// $ExpectType Object3DGroup<Mesh>
|
||||
const testObject3dGroup2 = new AMap.Object3DGroup<AMap.Object3D.Mesh>();
|
||||
|
||||
// $ExpectType Object3D[]
|
||||
testObject3dGroup1.children;
|
||||
// $ExpectType Mesh[]
|
||||
testObject3dGroup2.children;
|
||||
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.add(line);
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.add(mesh);
|
||||
// $ExoectType void
|
||||
testObject3dGroup2.add(mesh);
|
||||
// $ExpectError
|
||||
testObject3dGroup2.add(line);
|
||||
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.remove(line);
|
||||
// $ExoectType void
|
||||
testObject3dGroup1.remove(mesh);
|
||||
// $ExoectType void
|
||||
testObject3dGroup2.remove(mesh);
|
||||
// $ExpectError
|
||||
testObject3dGroup2.remove(line);
|
||||
|
||||
/**
|
||||
* object3d-Layer.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Object3DLayer
|
||||
new AMap.Object3DLayer();
|
||||
// $ExpectType Object3DLayer
|
||||
new AMap.Object3DLayer({});
|
||||
// $ExpectType Object3DLayer
|
||||
const testObject3DLayer = new AMap.Object3DLayer({
|
||||
map,
|
||||
visible: true,
|
||||
opacity: 0.1,
|
||||
zIndex: 2,
|
||||
zooms: [1, 2]
|
||||
});
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setMap(null);
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setMap(map);
|
||||
|
||||
// $ExpectType Map | null | undefined
|
||||
testObject3DLayer.getMap();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.hide();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.show();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setOpacity(1);
|
||||
|
||||
// $ExpectType number
|
||||
testObject3DLayer.getOpacity();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.setzIndex(1);
|
||||
|
||||
// $ExpectType number
|
||||
testObject3DLayer.getzIndex();
|
||||
|
||||
// $ExpectType [number, number]
|
||||
testObject3DLayer.getZooms();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.add(object3d);
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.remove(object3d);
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.clear();
|
||||
|
||||
// $ExpectType void
|
||||
testObject3DLayer.reDraw();
|
||||
|
||||
/**
|
||||
* vector3.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Vector3
|
||||
const testVector = new AMap.Vector3([1, 2, 3]);
|
||||
// $ExpectType Vector3
|
||||
new AMap.Vector3(testVector);
|
||||
|
||||
// $ExpectType [number, number, number]
|
||||
testVector.elements;
|
||||
|
||||
// $ExpectType void
|
||||
testVector.set(1, 2, 3);
|
||||
|
||||
// $ExpectType number
|
||||
testVector.dot();
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.clone();
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.add(testVector);
|
||||
// $ExpectType Vector3
|
||||
testVector.add([1, 2, 3]);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.sub(testVector);
|
||||
// $ExpectType Vector3
|
||||
testVector.sub([1, 2, 3]);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.addVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.subVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.crossVectors(testVector, testVector);
|
||||
|
||||
// $ExpectType Vector3
|
||||
testVector.normalize();
|
||||
|
||||
// $ExpectType number
|
||||
testVector.length();
|
||||
|
||||
/**
|
||||
* object3d/mesh.ts
|
||||
*/
|
||||
|
||||
// $ExpectType Mesh
|
||||
const testMesh = new AMap.Object3D.Mesh();
|
||||
|
||||
// $ExpectError
|
||||
testMesh.geometry = geometry;
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertices = [];
|
||||
testMesh.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertexColors = [];
|
||||
testMesh.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMesh.geometry.vertexUVs = [];
|
||||
testMesh.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.faces;
|
||||
// $ExpectError
|
||||
testMesh.geometry.faces = [];
|
||||
testMesh.geometry.faces.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMesh.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMesh.geometry.textureIndices = [];
|
||||
testMesh.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType (string | HTMLCanvasElement)[]
|
||||
testMesh.textures;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.needUpdate;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.transparent;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMesh.DEPTH_TEST;
|
||||
|
||||
// $ExpectType void
|
||||
testMesh.reDraw();
|
||||
|
||||
/**
|
||||
* object3d/meshAcceptLights.ts
|
||||
*/
|
||||
|
||||
// $ExpectType MeshAcceptLights
|
||||
const testMeshAcceptLights = new AMap.Object3D.MeshAcceptLights();
|
||||
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry = geometry;
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertices = [];
|
||||
testMeshAcceptLights.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexColors = [];
|
||||
testMeshAcceptLights.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexUVs = [];
|
||||
testMeshAcceptLights.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.faces;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.faces = [];
|
||||
testMeshAcceptLights.geometry.faces.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.textureIndices = [];
|
||||
testMeshAcceptLights.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshAcceptLights.geometry.vertexNormals;
|
||||
// $ExpectError
|
||||
testMeshAcceptLights.geometry.vertexNormals = [];
|
||||
testMeshAcceptLights.geometry.vertexNormals.shift();
|
||||
|
||||
// $ExpectType (string | HTMLCanvasElement)[]
|
||||
testMeshAcceptLights.textures;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.needUpdate;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.transparent;
|
||||
|
||||
// $ExpectType boolean
|
||||
testMeshAcceptLights.DEPTH_TEST;
|
||||
|
||||
// $ExpectType void
|
||||
testMeshAcceptLights.reDraw();
|
||||
|
||||
/**
|
||||
* object3d/meshLine.ts
|
||||
*/
|
||||
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine();
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({});
|
||||
// $ExpectType MeshLine
|
||||
const testMeshLine = new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
width: 1,
|
||||
height: 1,
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
color: [0, 0, 1, 1]
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [[1, 2]]
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
unit: 'meter'
|
||||
});
|
||||
// $ExpectType MeshLine
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [pixel],
|
||||
unit: 'px'
|
||||
});
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [lnglat],
|
||||
unit: 'px'
|
||||
});
|
||||
// $ExpectError
|
||||
new AMap.Object3D.MeshLine({
|
||||
path: [pixel],
|
||||
unit: 'meter'
|
||||
});
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertices = [];
|
||||
testMeshLine.geometry.vertices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexUVs;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexUVs = [];
|
||||
testMeshLine.geometry.vertexUVs.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexColors = [];
|
||||
testMeshLine.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexColors;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexColors = [];
|
||||
testMeshLine.geometry.vertexColors.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.vertexIndices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.vertexIndices = [];
|
||||
testMeshLine.geometry.vertexIndices.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.directions;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.directions = [];
|
||||
testMeshLine.geometry.directions.shift();
|
||||
|
||||
// $ExpectType number[]
|
||||
testMeshLine.geometry.textureIndices;
|
||||
// $ExpectError
|
||||
testMeshLine.geometry.textureIndices = [];
|
||||
testMeshLine.geometry.textureIndices.shift();
|
||||
|
||||
// $ExpectType number
|
||||
testMeshLine.width;
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([lnglat]);
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([lnglatTuple]);
|
||||
// $ExpectType void
|
||||
testMeshLine.setPath([pixel]);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setWidth(10);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setHeight(10);
|
||||
|
||||
// $ExpectType void
|
||||
testMeshLine.setColor('red');
|
||||
|
||||
/**
|
||||
* object3d/prism.ts
|
||||
*/
|
||||
|
||||
// $ExpectError
|
||||
new AMap.Object3D.Prism();
|
||||
// $ExpectError
|
||||
new AMap.Object3D.Prism({});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red',
|
||||
height: 1,
|
||||
color2: 'blue'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [pixel],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[lnglat]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[pixel]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [[lnglatTuple]],
|
||||
color: 'red'
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: ['red']
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: [1, 1, 1, 1]
|
||||
});
|
||||
// $ExpectType Prism
|
||||
new AMap.Object3D.Prism({
|
||||
path: [lnglat],
|
||||
color: [[1, 1, 1, 1]]
|
||||
});
|
||||
28
types/amap-js-api-map3d/geometry-3d.d.ts
vendored
Normal file
28
types/amap-js-api-map3d/geometry-3d.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
declare namespace AMap {
|
||||
abstract class Geometry3D {
|
||||
readonly vertices: number[];
|
||||
readonly vertexUVs: number[];
|
||||
readonly vertexColors: number[];
|
||||
}
|
||||
|
||||
namespace Geometry3D {
|
||||
class Mesh extends Geometry3D {
|
||||
readonly type: 'mesh';
|
||||
readonly faces: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
|
||||
class Line extends Geometry3D {
|
||||
readonly type: 'line';
|
||||
readonly segments: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
|
||||
class Points extends Geometry3D {
|
||||
readonly type: 'points';
|
||||
readonly pointSizes: number[];
|
||||
readonly pointAreas: number[];
|
||||
readonly textureIndices: number[];
|
||||
}
|
||||
}
|
||||
}
|
||||
15
types/amap-js-api-map3d/index.d.ts
vendored
Normal file
15
types/amap-js-api-map3d/index.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Type definitions for non-npm package amap-js-api-map3d 1.4
|
||||
// Project: https://lbs.amap.com/api/javascript-api/reference/maps-3d
|
||||
// Definitions by: breeze9527 <https://github.com/breeze9527>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="amap-js-api" />
|
||||
|
||||
/// <reference path="geometry-3d.d.ts" />
|
||||
/// <reference path="lights.d.ts" />
|
||||
/// <reference path="map3d.d.ts" />
|
||||
/// <reference path="object3d-group.d.ts" />
|
||||
/// <reference path="object3d-layer.d.ts" />
|
||||
/// <reference path="object3d.d.ts" />
|
||||
/// <reference path="vector3.d.ts" />
|
||||
17
types/amap-js-api-map3d/lights.d.ts
vendored
Normal file
17
types/amap-js-api-map3d/lights.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
declare namespace AMap {
|
||||
namespace Lights {
|
||||
class AmbientLight {
|
||||
constructor(color: [number, number, number], intensity: number);
|
||||
setColor(color: [number, number, number]): void;
|
||||
setIntensity(intensity: number): void;
|
||||
}
|
||||
|
||||
class DirectionLight {
|
||||
constructor(direction: [number, number, number], color: [number, number, number], intensity: number);
|
||||
update(): void;
|
||||
setDirection(direction: [number, number, number]): void;
|
||||
setColor(direction: [number, number, number]): void;
|
||||
setIntensity(intensity: number): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
types/amap-js-api-map3d/map3d.d.ts
vendored
Normal file
15
types/amap-js-api-map3d/map3d.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
declare namespace AMap {
|
||||
namespace Map {
|
||||
interface Object3DResult {
|
||||
index: number;
|
||||
point: Vector3;
|
||||
distance: number;
|
||||
object: Object3D;
|
||||
}
|
||||
}
|
||||
interface Map {
|
||||
AmbientLight?: Lights.AmbientLight;
|
||||
DirectionLight?: Lights.DirectionLight;
|
||||
getObject3DByContainerPos(pixel: Pixel, layers?: Layer[], all?: boolean): Map.Object3DResult | null;
|
||||
}
|
||||
}
|
||||
8
types/amap-js-api-map3d/object3d-group.d.ts
vendored
Normal file
8
types/amap-js-api-map3d/object3d-group.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
declare namespace AMap {
|
||||
class Object3DGroup<C extends Object3D = Object3D> extends Object3D {
|
||||
constructor();
|
||||
children: C[];
|
||||
add(object3d: C): void;
|
||||
remove(object3d: C): void;
|
||||
}
|
||||
}
|
||||
27
types/amap-js-api-map3d/object3d-layer.d.ts
vendored
Normal file
27
types/amap-js-api-map3d/object3d-layer.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
declare namespace AMap {
|
||||
namespace Object3DLayer {
|
||||
interface Options {
|
||||
map?: Map;
|
||||
visible?: boolean;
|
||||
opacity?: number;
|
||||
zIndex?: number;
|
||||
zooms?: [number, number];
|
||||
}
|
||||
}
|
||||
|
||||
class Object3DLayer extends Layer {
|
||||
constructor(options?: Object3DLayer.Options)
|
||||
add(object3d: Object3D): void;
|
||||
remove(object3d: Object3D): void;
|
||||
clear(): void;
|
||||
reDraw(): void;
|
||||
|
||||
// internal
|
||||
setOption(options: {
|
||||
position?: number;
|
||||
scale?: number;
|
||||
height?: number;
|
||||
scene?: number;
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
92
types/amap-js-api-map3d/object3d.d.ts
vendored
Normal file
92
types/amap-js-api-map3d/object3d.d.ts
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
declare namespace AMap {
|
||||
class Object3D {
|
||||
readonly geometry: Geometry3D;
|
||||
transparent: boolean;
|
||||
DEPTH_TEST: boolean;
|
||||
textures: Array<string | HTMLCanvasElement>;
|
||||
needUpdate: boolean;
|
||||
reDraw(): void;
|
||||
|
||||
// internal
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
namespace Object3D {
|
||||
class Mesh extends Object3D {
|
||||
readonly geometry: Geometry3D.Mesh;
|
||||
}
|
||||
|
||||
class MeshAcceptLights extends Mesh {
|
||||
readonly geometry: Geometry3D.Mesh & { readonly vertexNormals: number[] };
|
||||
}
|
||||
|
||||
namespace Prism {
|
||||
interface Options {
|
||||
path: LngLat[] | Pixel[] | Array<LngLat[] | Pixel[] | Array<[number, number]>>;
|
||||
color: string | number[] | Array<string | number[]>;
|
||||
height?: number;
|
||||
color2?: string | number[] | Array<string | number[]>;
|
||||
}
|
||||
}
|
||||
class Prism extends MeshAcceptLights {
|
||||
constructor(options: Prism.Options);
|
||||
}
|
||||
|
||||
// tslint:disable-next-line
|
||||
class Wall extends Prism { }
|
||||
|
||||
class Line extends Object3D {
|
||||
readonly geometry: Geometry3D.Line;
|
||||
}
|
||||
|
||||
namespace ThinLine {
|
||||
interface Options {
|
||||
path: Array<[number, number]>;
|
||||
color: string;
|
||||
altitude?: number;
|
||||
dashArray?: number[];
|
||||
}
|
||||
}
|
||||
class ThinLine extends Line {
|
||||
constructor(options: ThinLine.Options);
|
||||
}
|
||||
|
||||
class Points extends Object3D {
|
||||
readonly geometry: Geometry3D.Points;
|
||||
borderColor: string;
|
||||
borderWeight: number;
|
||||
}
|
||||
|
||||
class RoundPoints extends Points {
|
||||
merge: boolean;
|
||||
}
|
||||
|
||||
namespace MeshLine {
|
||||
type Options = {
|
||||
width?: number;
|
||||
height?: number | number[];
|
||||
color?: string | number[];
|
||||
} & ({
|
||||
unit?: 'meter';
|
||||
path: Array<[number, number]> | LngLat[];
|
||||
} | {
|
||||
unit: 'px';
|
||||
path: Array<[number, number]> | Pixel[];
|
||||
});
|
||||
}
|
||||
// inherit from WideLine
|
||||
class MeshLine extends Object3D {
|
||||
constructor(options: MeshLine.Options);
|
||||
readonly geometry: Geometry3D & {
|
||||
readonly vertexIndices: number[];
|
||||
readonly directions: number[];
|
||||
readonly textureIndices: number[];
|
||||
};
|
||||
width: number;
|
||||
setPath(path: LngLat[] | Pixel[] | Array<[number, number]>): void;
|
||||
setWidth(width: number): void;
|
||||
setHeight(height: number | number[]): void;
|
||||
setColor(color: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
types/amap-js-api-map3d/tsconfig.json
Normal file
31
types/amap-js-api-map3d/tsconfig.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"geometry-3d.d.ts",
|
||||
"index.d.ts",
|
||||
"lights.d.ts",
|
||||
"map3d.d.ts",
|
||||
"object3d-group.d.ts",
|
||||
"object3d-layer.d.ts",
|
||||
"object3d.d.ts",
|
||||
"vector3.d.ts",
|
||||
"amap-js-api-map3d-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/amap-js-api-map3d/tslint.json
Normal file
3
types/amap-js-api-map3d/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
16
types/amap-js-api-map3d/vector3.d.ts
vendored
Normal file
16
types/amap-js-api-map3d/vector3.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
declare namespace AMap {
|
||||
class Vector3 {
|
||||
readonly elements: [number, number, number];
|
||||
constructor(elements: [number, number, number] | Vector3);
|
||||
set(x: number, y: number, z: number): void;
|
||||
dot(): number;
|
||||
clone(): Vector3;
|
||||
add(elements: [number, number, number] | Vector3): this;
|
||||
sub(elements: [number, number, number] | Vector3): this;
|
||||
addVectors(a: Vector3, b: Vector3): this;
|
||||
subVectors(a: Vector3, b: Vector3): this;
|
||||
crossVectors(a: Vector3, b: Vector3): this;
|
||||
normalize(): this;
|
||||
length(): number;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user