21 |
22 |
23 |
24 |
132 |
142 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-tmap
2 |
3 | 
4 | 
5 | 
6 |
7 | - zh_CN [简体中文](https://github.com/didi/vue-tmap/blob/main/README.zh_CN.md)
8 |
9 | ### Introduction
10 |
11 | vue-tmap, a high-performance map component library for Vue3 based on Tencent Maps and TypeScript encapsulation, has the following features:
12 |
13 | - Improve documentation: improve the readability of documentation based on official documentation and framework usage, and improve component examples
14 | - Componentization: Encapsulate the Tencent Maps imperative api as a responsive component, no need to care about the complex map api, only need to operate the data
15 | - Multi-framework: including [react-tmap](https://github.com/didi/react-tmap) and [vue-tmap](https://github.com/didi/vue-tmap), and share the same set of type definitions
16 | - Type-safe: supplemented the type declaration of Tencent Maps sdk, components are also developed using TypeScript, a better development experience
17 | - Custom components: provide an open map instance, you can write custom components or directly call the map's native api
18 | - Performance optimization: unify the map api calling method and data monitoring to prevent performance problems caused by misuse of the map api
19 |
20 | ### Documentation and Examples
21 |
22 | Welcome to [Official document address](https://didi.github.io/vue-tmap/) to view more map components.
23 |
24 | - [Tencent Maps Official Documentation](https://lbs.qq.com/webApi/javascriptGL/glDoc/glDocIndex)
25 |
26 | ### Main Components
27 |
28 | | tmap-class | vue component | Introduction |
29 | | ------------- | ------------------- | -------------------------- |
30 | | Map | tmap-map | Map base components |
31 | | MultiMarker | tmap-multi-marker | Multiple Marker Points |
32 | | MultiPolyline | tmap-multi-polyline | Polyline |
33 | | MultiPolygon | tmap-multi-polygon | Polygon |
34 | | MultiLabel | tmap-multi-label | Text Labeling |
35 | | MultiCircle | tmap-multi-circle | Circle |
36 | | DOMOverlay | tmap-dom-overlay | DOM overlay abstract class |
37 | | InfoWindow | tmap-info-window | Information prompt window |
38 | | MarkerCluster | tmap-marker-cluster | Point Aggregation |
39 |
40 | ### Quick start
41 |
42 | #### Install
43 |
44 | ```shell
45 | npm install @map-component/vue-tmap
46 | ```
47 |
48 | #### Apply for Tencent map key
49 |
50 | https://lbs.qq.com/dev/console/key/manage
51 |
52 | #### Simple example
53 |
54 | ```vue
55 |
56 |
64 |
65 |
66 |
67 |
96 | ```
97 |
98 | > mapKey is the newly applied key
99 |
100 | ### Contribution Guidelines
101 |
102 | > Thanks to all the technical enthusiasts who participated in the contribution, let's build an easy-to-use map component library together
103 |
104 | #### Commit bug
105 |
106 | Please submit a bug through issue, and describe in detail how to reproduce the error and the version of dependencies. It is best to display the reproduced code through an online code editor.
107 |
108 | #### Submit code
109 |
110 | Please submit your code via pull request and we'll take a look soon
111 |
112 | #### Start development
113 |
114 | ```
115 | git clone xxx
116 |
117 | cd react-tmap // cd vue-tmap
118 |
119 | npm install
120 |
121 | npm run dev
122 | ```
123 |
124 | ### communicate with
125 |
126 | Add WeChat group after open source
127 |
--------------------------------------------------------------------------------
/src/examples/polygon-editor.vue:
--------------------------------------------------------------------------------
1 |
2 |
40 |
41 |
42 |
153 |
154 |
164 |
--------------------------------------------------------------------------------
/src/components/polygon-editor.ts:
--------------------------------------------------------------------------------
1 | import {
2 | defineComponent,
3 | inject,
4 | onUnmounted,
5 | PropType,
6 | Ref,
7 | toRaw,
8 | watch,
9 | } from 'vue';
10 | import useCleanUp from '../composables/use-clean-up';
11 | import { builtStyle, buildGeometries } from './multi-polygon';
12 |
13 | export default defineComponent({
14 | name: 'tmap-polygon-editor',
15 | props: {
16 | id: {
17 | type: String,
18 | default: 'default',
19 | },
20 | zIndex: {
21 | type: Number,
22 | default: 2,
23 | },
24 | snappable: {
25 | type: Boolean,
26 | default: true,
27 | },
28 | drawingStyleId: {
29 | type: String,
30 | default: 'drawing',
31 | },
32 | selectedStyleId: {
33 | type: String,
34 | default: 'selected',
35 | },
36 | styles: {
37 | type: Object as PropType<{ [key: string]: TMap.PolygonStyleOptions }>,
38 | required: true,
39 | },
40 | modelValue: {
41 | type: Array as PropType,
42 | required: true,
43 | },
44 | actionMode: {
45 | type: Number,
46 | },
47 | },
48 | emits: ['update:modelValue', 'select', 'error'],
49 | setup(props, { emit }) {
50 | const map = inject>('map');
51 | if (!map) {
52 | return {};
53 | }
54 | const originMap = toRaw(map.value);
55 | useCleanUp(originMap, props.id);
56 | const geometries = buildGeometries(props.modelValue);
57 | const polygon = new TMap.MultiPolygon({
58 | id: props.id,
59 | map: originMap,
60 | zIndex: props.zIndex,
61 | styles: builtStyle(props.styles),
62 | geometries,
63 | });
64 | const editor = new TMap.tools.GeometryEditor({
65 | map: originMap,
66 | overlayList: [
67 | {
68 | overlay: polygon,
69 | id: props.id,
70 | drawingStyleId: props.drawingStyleId,
71 | selectedStyleId: props.selectedStyleId,
72 | },
73 | ],
74 | actionMode:
75 | props.actionMode === 1
76 | ? TMap.tools.constants.EDITOR_ACTION.INTERACT
77 | : TMap.tools.constants.EDITOR_ACTION.DRAW,
78 | activeOverlayId: props.id, // 激活图层
79 | selectable: true, // 开启点选功能
80 | snappable: props.snappable, // 开启吸附
81 | });
82 | editor.on('select', () => {
83 | emit('select', editor.getSelectedList());
84 | });
85 | editor.on('draw_complete', (e: TMap.PolygonGeometry) => {
86 | emit('update:modelValue', [...props.modelValue, e]);
87 | });
88 | editor.on('adjust_complete', (e: TMap.PolygonGeometry) => {
89 | for (let i = props.modelValue.length - 1; i >= 0; i -= 1) {
90 | if (props.modelValue[i].id === e.id) {
91 | Object.assign(props.modelValue[i], e);
92 | emit('update:modelValue', [...props.modelValue]);
93 | break;
94 | }
95 | }
96 | });
97 | editor.on('delete_complete', (e: TMap.PolygonGeometry[]) => {
98 | const removedIds = e.map((v) => v.id);
99 | emit(
100 | 'update:modelValue',
101 | props.modelValue.filter((v) => removedIds.indexOf(v.id) === -1),
102 | );
103 | emit('select', editor.getSelectedList());
104 | });
105 | editor.on('split_complete', (e: TMap.PolygonGeometry[]) => {
106 | const activeOverlay = editor.getActiveOverlay();
107 | emit('update:modelValue', [
108 | ...activeOverlay.overlay.getGeometries(),
109 | ...e,
110 | ]);
111 | emit('select', editor.getSelectedList());
112 | });
113 | editor.on('union_complete', (e: TMap.PolygonGeometry) => {
114 | const activeOverlay = editor.getActiveOverlay();
115 | emit('update:modelValue', [...activeOverlay.overlay.getGeometries(), e]);
116 | emit('select', editor.getSelectedList());
117 | });
118 | editor.on('split_fail', (e: object) => {
119 | emit('error', e);
120 | });
121 | editor.on('union_fail', (e: object) => {
122 | emit('error', e);
123 | });
124 | watch(
125 | () => props.actionMode,
126 | (actionMode) => {
127 | const x: TMap.tools.constants.EDITOR_ACTION =
128 | actionMode === 1
129 | ? TMap.tools.constants.EDITOR_ACTION.INTERACT
130 | : TMap.tools.constants.EDITOR_ACTION.DRAW;
131 | editor.setActionMode(x);
132 | },
133 | );
134 | onUnmounted(() => {
135 | polygon.setMap(null);
136 | try {
137 | editor.destroy();
138 | } catch (e) {
139 | // 直接销毁地图时会报错,兼容一下
140 | }
141 | });
142 | return {
143 | select: editor.select.bind(editor),
144 | stop: editor.stop.bind(editor),
145 | split: editor.split.bind(editor),
146 | union: editor.union.bind(editor),
147 | delete: editor.delete.bind(editor),
148 | destroy: editor.destroy.bind(editor),
149 | };
150 | },
151 | render() {
152 | return null;
153 | },
154 | });
155 |
--------------------------------------------------------------------------------
/src/components/map.ts:
--------------------------------------------------------------------------------
1 | import {
2 | defineComponent,
3 | ref,
4 | provide,
5 | onMounted,
6 | onUnmounted,
7 | h,
8 | PropType,
9 | watch,
10 | } from 'vue';
11 | import loadSDK from '../utils/loadSDK';
12 |
13 | type ControlConfig = { position: string; className: string };
14 | type PositionMap = {
15 | [key: string]: TMap.constants.CONTROL_POSITION;
16 | };
17 |
18 | function setMapCtrl(
19 | mapIns: TMap.Map,
20 | ctrlId: TMap.constants.DEFAULT_CONTROL_ID,
21 | config: ControlConfig,
22 | positionMap: PositionMap,
23 | ) {
24 | if (!config) {
25 | mapIns.removeControl(ctrlId);
26 | return;
27 | }
28 | const ctrl = mapIns.getControl(ctrlId);
29 | const { position, className } = config;
30 | if (positionMap[position]) {
31 | ctrl.setPosition(positionMap[position]);
32 | }
33 | ctrl.setClassName(className);
34 | }
35 |
36 | export default defineComponent({
37 | name: 'tmap-map',
38 | props: {
39 | version: {
40 | type: String,
41 | default: '1.exp',
42 | },
43 | mapKey: {
44 | type: String,
45 | default: '',
46 | },
47 | libraries: {
48 | type: Array as PropType,
49 | default: () => [],
50 | },
51 | class: {
52 | type: String,
53 | default: '',
54 | },
55 | style: {
56 | type: Object as PropType<{}>,
57 | default: () => ({}),
58 | },
59 | center: {
60 | type: Object as PropType<{ lat: number; lng: number }>,
61 | default: () => ({ lat: 40.040452, lng: 116.273486 }),
62 | },
63 | zoom: {
64 | type: Number,
65 | default: 17,
66 | },
67 | minZoom: {
68 | type: Number,
69 | default: 3,
70 | },
71 | maxZoom: {
72 | type: Number,
73 | default: 20,
74 | },
75 | rotation: {
76 | type: Number,
77 | default: 0,
78 | },
79 | pitch: {
80 | type: Number,
81 | default: 0,
82 | },
83 | scale: {
84 | type: Number,
85 | default: 1,
86 | },
87 | offset: {
88 | type: Object as PropType<{ x: number; y: number }>,
89 | default: () => ({ x: 0, y: 0 }),
90 | },
91 | draggable: {
92 | type: Boolean,
93 | default: true,
94 | },
95 | scrollable: {
96 | type: Boolean,
97 | default: true,
98 | },
99 | doubleClickZoom: {
100 | type: Boolean,
101 | default: true,
102 | },
103 | boundary: {
104 | type: Object as PropType,
105 | default: null,
106 | },
107 | mapStyleId: {
108 | type: String,
109 | },
110 | baseMap: {
111 | type: Object as PropType,
112 | },
113 | viewMode: {
114 | type: String as PropType<'2D' | '3D'>,
115 | default: '3D',
116 | },
117 | control: {
118 | type: Object as PropType<{
119 | scale: { position: string; className: string };
120 | zoom: { position: string; className: string };
121 | rotation: { position: string; className: string };
122 | }>,
123 | default: () => ({ scale: {}, zoom: {}, rotation: {} }),
124 | },
125 | events: {
126 | type: Object as PropType<{ [key: string]: Function }>,
127 | default: () => ({}),
128 | },
129 | },
130 | setup(props) {
131 | const el = ref(null);
132 | const map = ref(null);
133 | let mapIns: TMap.Map;
134 | let positionMap: PositionMap;
135 | const events: string[] = [];
136 | Object.keys(props.events).forEach((eventName) => {
137 | events.push(eventName);
138 | });
139 | onMounted(async () => {
140 | await loadSDK(props.version, props.mapKey, props.libraries);
141 | positionMap = {
142 | topLeft: TMap.constants.CONTROL_POSITION.TOP_LEFT,
143 | topCenter: TMap.constants.CONTROL_POSITION.TOP_CENTER,
144 | topRight: TMap.constants.CONTROL_POSITION.TOP_RIGHT,
145 | centerLeft: TMap.constants.CONTROL_POSITION.CENTER_LEFT,
146 | center: TMap.constants.CONTROL_POSITION.CENTER,
147 | centerRight: TMap.constants.CONTROL_POSITION.CENTER_RIGHT,
148 | bottomLeft: TMap.constants.CONTROL_POSITION.BOTTOM_LEFT,
149 | bottomCenter: TMap.constants.CONTROL_POSITION.BOTTOM_CENTER,
150 | bottomRight: TMap.constants.CONTROL_POSITION.BOTTOM_RIGHT,
151 | };
152 | const center = new TMap.LatLng(props.center.lat, props.center.lng);
153 | if (el.value) {
154 | mapIns = new TMap.Map(el.value, {
155 | center,
156 | zoom: props.zoom,
157 | minZoom: props.minZoom,
158 | maxZoom: props.maxZoom,
159 | rotation: props.rotation,
160 | pitch: props.pitch,
161 | scale: props.scale,
162 | offset: props.offset,
163 | draggable: props.draggable,
164 | scrollable: props.scrollable,
165 | doubleClickZoom: props.doubleClickZoom,
166 | boundary: props.boundary,
167 | mapStyleId: props.mapStyleId,
168 | baseMap: props.baseMap,
169 | viewMode: props.viewMode,
170 | showControl: true,
171 | });
172 |
173 | setMapCtrl(
174 | mapIns,
175 | TMap.constants.DEFAULT_CONTROL_ID.SCALE,
176 | props.control.scale,
177 | positionMap,
178 | );
179 | setMapCtrl(
180 | mapIns,
181 | TMap.constants.DEFAULT_CONTROL_ID.ZOOM,
182 | props.control.zoom,
183 | positionMap,
184 | );
185 | setMapCtrl(
186 | mapIns,
187 | TMap.constants.DEFAULT_CONTROL_ID.ROTATION,
188 | props.control.rotation,
189 | positionMap,
190 | );
191 |
192 | events.forEach((eventName) => {
193 | mapIns.on(eventName, props.events[eventName]);
194 | });
195 |
196 | map.value = mapIns;
197 | }
198 | });
199 | onUnmounted(() => {
200 | if (mapIns) {
201 | events.forEach((eventName) => {
202 | mapIns.off(eventName, props.events[eventName]);
203 | });
204 | mapIns.destroy();
205 | }
206 | });
207 | watch(
208 | () => [props.center, props.zoom, props.rotation, props.pitch],
209 | ([center, zoom, rotation, pitch]) => {
210 | if (mapIns) {
211 | mapIns.easeTo(
212 | {
213 | // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
214 | // @ts-ignore
215 | center: new TMap.LatLng(center.lat, center.lng),
216 | zoom: zoom as number,
217 | rotation: rotation as number,
218 | pitch: pitch as number,
219 | },
220 | {
221 | duration: 500,
222 | },
223 | );
224 | }
225 | },
226 | );
227 | watch(
228 | () => props.scale,
229 | (value) => mapIns && mapIns.setScale(value),
230 | );
231 | watch(
232 | () => props.offset,
233 | (value) => mapIns && mapIns.setOffset(value),
234 | );
235 | watch(
236 | () => props.draggable,
237 | (value) => mapIns && mapIns.setDraggable(value),
238 | );
239 | watch(
240 | () => props.scrollable,
241 | (value) => mapIns && mapIns.setScrollable(value),
242 | );
243 | watch(
244 | () => props.doubleClickZoom,
245 | (value) => mapIns && mapIns.setDoubleClickZoom(value),
246 | );
247 | watch(
248 | () => props.boundary,
249 | (value) => mapIns && mapIns.setBoundary(value),
250 | );
251 | watch(
252 | () => props.control,
253 | (value) => {
254 | setMapCtrl(
255 | mapIns,
256 | TMap.constants.DEFAULT_CONTROL_ID.SCALE,
257 | value.scale,
258 | positionMap,
259 | );
260 | setMapCtrl(
261 | mapIns,
262 | TMap.constants.DEFAULT_CONTROL_ID.ZOOM,
263 | value.zoom,
264 | positionMap,
265 | );
266 | setMapCtrl(
267 | mapIns,
268 | TMap.constants.DEFAULT_CONTROL_ID.ROTATION,
269 | value.rotation,
270 | positionMap,
271 | );
272 | },
273 | );
274 | provide('map', map);
275 | return {
276 | map,
277 | el,
278 | getCenter: () => mapIns?.getCenter(),
279 | getZoom: () => mapIns?.getZoom(),
280 | };
281 | },
282 | render() {
283 | return h(
284 | 'div',
285 | {
286 | class: this.class,
287 | style: { ...this.style, height: '100%', width: '100%' },
288 | ref: 'el',
289 | },
290 | this.$slots.default && this.map ? this.$slots.default() : [],
291 | );
292 | },
293 | });
294 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 |
3 | Version 2.0, January 2004
4 |
5 | http://www.apache.org/licenses/
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 |
9 | 1. Definitions.
10 |
11 | "License" shall mean the terms and conditions for use, reproduction,
12 |
13 | and distribution as defined by Sections 1 through 9 of this document.
14 |
15 | "Licensor" shall mean the copyright owner or entity authorized by
16 |
17 | the copyright owner that is granting the License.
18 |
19 | "Legal Entity" shall mean the union of the acting entity and all
20 |
21 | other entities that control, are controlled by, or are under common
22 |
23 | control with that entity. For the purposes of this definition,
24 |
25 | "control" means (i) the power, direct or indirect, to cause the
26 |
27 | direction or management of such entity, whether by contract or
28 |
29 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
30 |
31 | outstanding shares, or (iii) beneficial ownership of such entity.
32 |
33 | "You" (or "Your") shall mean an individual or Legal Entity
34 |
35 | exercising permissions granted by this License.
36 |
37 | "Source" form shall mean the preferred form for making modifications,
38 |
39 | including but not limited to software source code, documentation
40 |
41 | source, and configuration files.
42 |
43 | "Object" form shall mean any form resulting from mechanical
44 |
45 | transformation or translation of a Source form, including but
46 |
47 | not limited to compiled object code, generated documentation,
48 |
49 | and conversions to other media types.
50 |
51 | "Work" shall mean the work of authorship, whether in Source or
52 |
53 | Object form, made available under the License, as indicated by a
54 |
55 | copyright notice that is included in or attached to the work
56 |
57 | (an example is provided in the Appendix below).
58 |
59 | "Derivative Works" shall mean any work, whether in Source or Object
60 |
61 | form, that is based on (or derived from) the Work and for which the
62 |
63 | editorial revisions, annotations, elaborations, or other modifications
64 |
65 | represent, as a whole, an original work of authorship. For the purposes
66 |
67 | of this License, Derivative Works shall not include works that remain
68 |
69 | separable from, or merely link (or bind by name) to the interfaces of,
70 |
71 | the Work and Derivative Works thereof.
72 |
73 | "Contribution" shall mean any work of authorship, including
74 |
75 | the original version of the Work and any modifications or additions
76 |
77 | to that Work or Derivative Works thereof, that is intentionally
78 |
79 | submitted to Licensor for inclusion in the Work by the copyright owner
80 |
81 | or by an individual or Legal Entity authorized to submit on behalf of
82 |
83 | the copyright owner. For the purposes of this definition, "submitted"
84 |
85 | means any form of electronic, verbal, or written communication sent
86 |
87 | to the Licensor or its representatives, including but not limited to
88 |
89 | communication on electronic mailing lists, source code control systems,
90 |
91 | and issue tracking systems that are managed by, or on behalf of, the
92 |
93 | Licensor for the purpose of discussing and improving the Work, but
94 |
95 | excluding communication that is conspicuously marked or otherwise
96 |
97 | designated in writing by the copyright owner as "Not a Contribution."
98 |
99 | "Contributor" shall mean Licensor and any individual or Legal Entity
100 |
101 | on behalf of whom a Contribution has been received by Licensor and
102 |
103 | subsequently incorporated within the Work.
104 |
105 | 2. Grant of Copyright License. Subject to the terms and conditions of
106 |
107 | this License, each Contributor hereby grants to You a perpetual,
108 |
109 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
110 |
111 | copyright license to reproduce, prepare Derivative Works of,
112 |
113 | publicly display, publicly perform, sublicense, and distribute the
114 |
115 | Work and such Derivative Works in Source or Object form.
116 |
117 | 3) Grant of Patent License. Subject to the terms and conditions of
118 |
119 | this License, each Contributor hereby grants to You a perpetual,
120 |
121 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
122 |
123 | (except as stated in this section) patent license to make, have made,
124 |
125 | use, offer to sell, sell, import, and otherwise transfer the Work,
126 |
127 | where such license applies only to those patent claims licensable
128 |
129 | by such Contributor that are necessarily infringed by their
130 |
131 | Contribution(s) alone or by combination of their Contribution(s)
132 |
133 | with the Work to which such Contribution(s) was submitted. If You
134 |
135 | institute patent litigation against any entity (including a
136 |
137 | cross-claim or counterclaim in a lawsuit) alleging that the Work
138 |
139 | or a Contribution incorporated within the Work constitutes direct
140 |
141 | or contributory patent infringement, then any patent licenses
142 |
143 | granted to You under this License for that Work shall terminate
144 |
145 | as of the date such litigation is filed.
146 |
147 | 4. Redistribution. You may reproduce and distribute copies of the
148 |
149 | Work or Derivative Works thereof in any medium, with or without
150 |
151 | modifications, and in Source or Object form, provided that You
152 |
153 | meet the following conditions:
154 |
155 | (a) You must give any other recipients of the Work or
156 |
157 | Derivative Works a copy of this License; and
158 |
159 | (b) You must cause any modified files to carry prominent notices
160 |
161 | stating that You changed the files; and
162 |
163 | (c) You must retain, in the Source form of any Derivative Works
164 |
165 | that You distribute, all copyright, patent, trademark, and
166 |
167 | attribution notices from the Source form of the Work,
168 |
169 | excluding those notices that do not pertain to any part of
170 |
171 | the Derivative Works; and
172 |
173 | (d) If the Work includes a "NOTICE" text file as part of its
174 |
175 | distribution, then any Derivative Works that You distribute must
176 |
177 | include a readable copy of the attribution notices contained
178 |
179 | within such NOTICE file, excluding those notices that do not
180 |
181 | pertain to any part of the Derivative Works, in at least one
182 |
183 | of the following places: within a NOTICE text file distributed
184 |
185 | as part of the Derivative Works; within the Source form or
186 |
187 | documentation, if provided along with the Derivative Works; or,
188 |
189 | within a display generated by the Derivative Works, if and
190 |
191 | wherever such third-party notices normally appear. The contents
192 |
193 | of the NOTICE file are for informational purposes only and
194 |
195 | do not modify the License. You may add Your own attribution
196 |
197 | notices within Derivative Works that You distribute, alongside
198 |
199 | or as an addendum to the NOTICE text from the Work, provided
200 |
201 | that such additional attribution notices cannot be construed
202 |
203 | as modifying the License.
204 |
205 | You may add Your own copyright statement to Your modifications and
206 |
207 | may provide additional or different license terms and conditions
208 |
209 | for use, reproduction, or distribution of Your modifications, or
210 |
211 | for any such Derivative Works as a whole, provided Your use,
212 |
213 | reproduction, and distribution of the Work otherwise complies with
214 |
215 | the conditions stated in this License.
216 |
217 | 5. Submission of Contributions. Unless You explicitly state otherwise,
218 |
219 | any Contribution intentionally submitted for inclusion in the Work
220 |
221 | by You to the Licensor shall be under the terms and conditions of
222 |
223 | this License, without any additional terms or conditions.
224 |
225 | Notwithstanding the above, nothing herein shall supersede or modify
226 |
227 | the terms of any separate license agreement you may have executed
228 |
229 | with Licensor regarding such Contributions.
230 |
231 | 6) Trademarks. This License does not grant permission to use the trade
232 |
233 | names, trademarks, service marks, or product names of the Licensor,
234 |
235 | except as required for reasonable and customary use in describing the
236 |
237 | origin of the Work and reproducing the content of the NOTICE file.
238 |
239 | 7. Disclaimer of Warranty. Unless required by applicable law or
240 |
241 | agreed to in writing, Licensor provides the Work (and each
242 |
243 | Contributor provides its Contributions) on an "AS IS" BASIS,
244 |
245 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
246 |
247 | implied, including, without limitation, any warranties or conditions
248 |
249 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
250 |
251 | PARTICULAR PURPOSE. You are solely responsible for determining the
252 |
253 | appropriateness of using or redistributing the Work and assume any
254 |
255 | risks associated with Your exercise of permissions under this License.
256 |
257 | 8) Limitation of Liability. In no event and under no legal theory,
258 |
259 | whether in tort (including negligence), contract, or otherwise,
260 |
261 | unless required by applicable law (such as deliberate and grossly
262 |
263 | negligent acts) or agreed to in writing, shall any Contributor be
264 |
265 | liable to You for damages, including any direct, indirect, special,
266 |
267 | incidental, or consequential damages of any character arising as a
268 |
269 | result of this License or out of the use or inability to use the
270 |
271 | Work (including but not limited to damages for loss of goodwill,
272 |
273 | work stoppage, computer failure or malfunction, or any and all
274 |
275 | other commercial damages or losses), even if such Contributor
276 |
277 | has been advised of the possibility of such damages.
278 |
279 | 9. Accepting Warranty or Additional Liability. While redistributing
280 |
281 | the Work or Derivative Works thereof, You may choose to offer,
282 |
283 | and charge a fee for, acceptance of support, warranty, indemnity,
284 |
285 | or other liability obligations and/or rights consistent with this
286 |
287 | License. However, in accepting such obligations, You may act only
288 |
289 | on Your own behalf and on Your sole responsibility, not on behalf
290 |
291 | of any other Contributor, and only if You agree to indemnify,
292 |
293 | defend, and hold each Contributor harmless for any liability
294 |
295 | incurred by, or claims asserted against, such Contributor by reason
296 |
297 | of your accepting any such warranty or additional liability.
298 |
299 | END OF TERMS AND CONDITIONS
300 |
301 | APPENDIX: How to apply the Apache License to your work.
302 |
303 | To apply the Apache License to your work, attach the following
304 |
305 | boilerplate notice, with the fields enclosed by brackets "{}"
306 |
307 | replaced with your own identifying information. (Don't include
308 |
309 | the brackets!) The text should be enclosed in the appropriate
310 |
311 | comment syntax for the file format. We also recommend that a
312 |
313 | file or class name and description of purpose be included on the
314 |
315 | same "printed page" as the copyright notice for easier
316 |
317 | identification within third-party archives.
318 |
319 | Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. All rights reserved.
320 |
321 | Licensed under the Apache License, Version 2.0 (the "License");
322 |
323 | you may not use this file except in compliance with the License.
324 |
325 | You may obtain a copy of the License at
326 |
327 | http://www.apache.org/licenses/LICENSE-2.0
328 |
329 | Unless required by applicable law or agreed to in writing, software
330 |
331 | distributed under the License is distributed on an "AS IS" BASIS,
332 |
333 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334 |
335 | See the License for the specific language governing permissions and
336 |
337 | limitations under the License.
338 |
--------------------------------------------------------------------------------