Skip to content

Commit 1dd3f1a

Browse files
committed
【update】common ut SuperMap.xx 引入具体路径; review by luox
1 parent ad1888a commit 1dd3f1a

26 files changed

+210
-177
lines changed

test/classic/services/ProcessingServiceSpec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {ProcessingService} from '../../../src/classic/services/ProcessingService
22
import {SecurityManager} from '../../../src/common/security/SecurityManager';
33
import {KernelDensityJobParameter} from '../../../src/common/iServer/KernelDensityJobParameter';
44
import {SummaryMeshJobParameter} from '../../../src/common/iServer/SummaryMeshJobParameter';
5+
import {SummaryAttributesJobsParameter} from '../../../src/common/iServer/SummaryAttributesJobsParameter';
56
import {SingleObjectQueryJobsParameter} from '../../../src/common/iServer/SingleObjectQueryJobsParameter';
67
import {SummaryRegionJobParameter} from '../../../src/common/iServer/SummaryRegionJobParameter';
78
import {VectorClipJobsParameter} from '../../../src/common/iServer/VectorClipJobsParameter';
@@ -1853,7 +1854,7 @@ describe('classic_ProcessingService', () => {
18531854
}
18541855
return Promise.resolve();
18551856
});
1856-
var summaryAttributesJobsParameter = new SuperMap.SummaryAttributesJobsParameter({
1857+
var summaryAttributesJobsParameter = new SummaryAttributesJobsParameter({
18571858
datasetName: "smtiles_processing_newyorkZone_R",
18581859
groupField: "",
18591860
attributeField: "",

test/common/commontypes/UtilSpec.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import {
2-
SuperMap
3-
} from "../../../src/common/SuperMap";
4-
import {
5-
Util
6-
} from '../../../src/common/commontypes/Util';
1+
import { Util } from '../../../src/common/commontypes/Util';
2+
import { Pixel } from '../../../src/common/commontypes/Pixel';
3+
import { Size } from '../../../src/common/commontypes/Size';
4+
import { Bounds } from '../../../src/common/commontypes/Bounds';
5+
import { Point as GeometryPoint } from '../../../src/common/commontypes/geometry/Point';
6+
import { ThemeStyle } from '../../../src/common/style/ThemeStyle';
7+
78

89
describe('Util', () => {
910

@@ -114,8 +115,8 @@ describe('Util', () => {
114115
it('modifyDOMElement', () => {
115116
var testDom = document.createElement("div");
116117
var id = "box";
117-
var px = new SuperMap.Pixel(99, 80);
118-
var sz = new SuperMap.Size(99, 80);
118+
var px = new Pixel(99, 80);
119+
var sz = new Size(99, 80);
119120
var position = "absolute";
120121
var border = "1px solid red";
121122
var overflow = "hidden";
@@ -216,8 +217,8 @@ describe('Util', () => {
216217
});
217218

218219
it("calculateDpi", () => {
219-
var viewBounds = new SuperMap.Bounds(-65.71902951325971, -65.71902951331374, 65.71902951333179, 65.71902951327776);
220-
var viewer = new SuperMap.Size(256, 256);
220+
var viewBounds = new Bounds(-65.71902951325971, -65.71902951331374, 65.71902951333179, 65.71902951327776);
221+
var viewer = new Size(256, 256);
221222
var scale = 4.629244301712164E-9;
222223
var coordUnit = "DEGREE";
223224
var datumAxis = 6378137;
@@ -336,23 +337,23 @@ describe('Util', () => {
336337

337338
it('lineIntersection', () => {
338339
//重合
339-
var a1 = new SuperMap.Geometry.Point(-111.04, 45.68);
340-
var a2 = new SuperMap.Geometry.Point(-152, 89);
341-
var a3 = new SuperMap.Geometry.Point(-111.04, 45.68);
342-
var a4 = new SuperMap.Geometry.Point(-152, 89);
340+
var a1 = new GeometryPoint(-111.04, 45.68);
341+
var a2 = new GeometryPoint(-152, 89);
342+
var a3 = new GeometryPoint(-111.04, 45.68);
343+
var a4 = new GeometryPoint(-152, 89);
343344
var intersectValue = Util.lineIntersection(a1, a2, a3, a4);
344345
expect(intersectValue).toEqual("Coincident");
345346
//平行
346-
var a5 = new SuperMap.Geometry.Point(20, 80);
347-
var a6 = new SuperMap.Geometry.Point(140, 160);
348-
var a7 = new SuperMap.Geometry.Point(20, 20);
349-
var a8 = new SuperMap.Geometry.Point(140, 100);
347+
var a5 = new GeometryPoint(20, 80);
348+
var a6 = new GeometryPoint(140, 160);
349+
var a7 = new GeometryPoint(20, 20);
350+
var a8 = new GeometryPoint(140, 100);
350351
var intersectValue1 = Util.lineIntersection(a5, a6, a7, a8);
351352
expect(intersectValue1).toEqual("Parallel");
352353
});
353354

354355
it('getTextBounds', () => {
355-
var style = new SuperMap.ThemeStyle({
356+
var style = new ThemeStyle({
356357
width: 200,
357358
height: 300,
358359
fontSize: 12,
@@ -370,4 +371,4 @@ describe('Util', () => {
370371
expect(result.textHeight).toEqual(18);
371372
});
372373

373-
});
374+
});

test/common/commontypes/geometry/CollectionSpec.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
require('../../../../src/common/commontypes/geometry/Collection');
1+
import { Point as GeometryPoint } from '../../../../src/common/commontypes/geometry/Point';
2+
import { Collection as GeometryCollection } from '../../../../src/common/commontypes/geometry/Collection';
23

34
describe('Collection', function () {
45
it('clone, getComponentsString, removeComponents', function () {
5-
var point1 = new SuperMap.Geometry.Point(10, 20);
6-
var point2 = new SuperMap.Geometry.Point(30, 40);
7-
var collection = new SuperMap.Geometry.Collection([point1, point2]);
6+
var point1 = new GeometryPoint(10, 20);
7+
var point2 = new GeometryPoint(30, 40);
8+
var collection = new GeometryCollection([point1, point2]);
89
var collection1 = collection.clone();
910
expect(collection.CLASS_NAME).toEqual(collection1.CLASS_NAME);
1011
expect(collection.components.length).toEqual(collection1.components.length);
@@ -24,11 +25,11 @@ describe('Collection', function () {
2425
});
2526

2627
it('addComponent_index<components.length', function () {
27-
var point1 = new SuperMap.Geometry.Point(10, 20);
28-
var point2 = new SuperMap.Geometry.Point(30, 40);
29-
var collection = new SuperMap.Geometry.Collection([point1, point2]);
28+
var point1 = new GeometryPoint(10, 20);
29+
var point2 = new GeometryPoint(30, 40);
30+
var collection = new GeometryCollection([point1, point2]);
3031
expect(collection.components.length).toEqual(2);
31-
var point3 = new SuperMap.Geometry.Point(10, 10);
32+
var point3 = new GeometryPoint(10, 10);
3233
collection.addComponent(point3, 0);
3334
expect(collection.components.length).toEqual(3);
3435
expect(collection.components[0].x).toEqual(10);
@@ -41,31 +42,31 @@ describe('Collection', function () {
4142
});
4243

4344
it('getArea', function () {
44-
var point1 = new SuperMap.Geometry.Point(1, 2);
45-
var point2 = new SuperMap.Geometry.Point(3, 2);
46-
var collection = new SuperMap.Geometry.Collection([point1, point2]);
45+
var point1 = new GeometryPoint(1, 2);
46+
var point2 = new GeometryPoint(3, 2);
47+
var collection = new GeometryCollection([point1, point2]);
4748
var area = collection.getArea();
4849
expect(area).toEqual(0);
4950
collection.destroy();
5051
});
5152

5253
it('equals', function () {
5354
//CLASS_NAME is not equal
54-
var point = new SuperMap.Geometry.Point(1, 2);
55-
var point1 = new SuperMap.Geometry.Point(2, 2);
56-
var collection = new SuperMap.Geometry.Collection([point]);
55+
var point = new GeometryPoint(1, 2);
56+
var point1 = new GeometryPoint(2, 2);
57+
var collection = new GeometryCollection([point]);
5758
var isEqual = collection.equals(point);
5859
expect(isEqual).toBeFalsy();
5960
//length of components is not equal
60-
var collection1 = new SuperMap.Geometry.Collection([point, point1]);
61+
var collection1 = new GeometryCollection([point, point1]);
6162
var isEqual1 = collection.equals(collection1);
6263
expect(isEqual1).toBeFalsy();
6364
//components[i] is not equal
64-
var collection2 = new SuperMap.Geometry.Collection([point1]);
65+
var collection2 = new GeometryCollection([point1]);
6566
var isEqual2 = collection.equals(collection2);
6667
expect(isEqual2).toBeFalsy();
6768
//equal
68-
var collection3 = new SuperMap.Geometry.Collection([point]);
69+
var collection3 = new GeometryCollection([point]);
6970
var isEqual3 = collection.equals(collection3);
7071
expect(isEqual3).toBeTruthy();
7172
collection.destroy();
@@ -75,9 +76,9 @@ describe('Collection', function () {
7576
});
7677

7778
it('getVertices', function () {
78-
var point1 = new SuperMap.Geometry.Point(10, 0);
79-
var point2 = new SuperMap.Geometry.Point(30, 0);
80-
var collection = new SuperMap.Geometry.Collection([point1, point2]);
79+
var point1 = new GeometryPoint(10, 0);
80+
var point2 = new GeometryPoint(30, 0);
81+
var collection = new GeometryCollection([point1, point2]);
8182
var vertices = collection.getVertices(false);
8283
expect(vertices.length).toEqual(2);
8384
expect(collection.components[0].x).toEqual(10);

test/common/commontypes/geometry/GeoTextSpec.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
require('../../../../src/common/commontypes/geometry/GeoText');
1+
import { GeoText as GeometryGeoText } from '../../../../src/common/commontypes/geometry/GeoText';
2+
import { Vector as FeatureVector } from '../../../../src/common/commontypes/Vector';
23

34
describe('GeoText', function () {
45
it('constructor, destroy', function () {
56
var x = 100, y = 35, text = "中华人民共和国";
6-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
7+
var geoText = new GeometryGeoText(x, y, text);
78
geoText.bsInfo = {
89
h: 100,
910
w: 150
1011
};
11-
var geoTextFeature = new SuperMap.Feature.Vector(geoText);
12+
var geoTextFeature = new FeatureVector(geoText);
1213
expect(geoText).not.toBeNull();
1314
expect(geoTextFeature).not.toBeNull();
1415
expect(geoTextFeature.CLASS_NAME).toEqual("SuperMap.Feature.Vector");
@@ -28,7 +29,7 @@ describe('GeoText', function () {
2829

2930
it('clone', function () {
3031
var x = 100, y = 35, text = "中华人民共和国";
31-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
32+
var geoText = new GeometryGeoText(x, y, text);
3233
var obj = geoText.clone();
3334
expect(geoText).not.toBeNull();
3435
expect(geoText.id).not.toBeNull();
@@ -46,7 +47,7 @@ describe('GeoText', function () {
4647

4748
it('calculateBounds', function () {
4849
var x = 100, y = 35, text = "中华人民共和国";
49-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
50+
var geoText = new GeometryGeoText(x, y, text);
5051
geoText.calculateBounds();
5152
expect(geoText).not.toBeNull();
5253
expect(geoText.bounds).not.toBeNull();
@@ -60,7 +61,7 @@ describe('GeoText', function () {
6061
//获取标签对象的质心
6162
it('getCentroid', function () {
6263
var x = 100, y = 35, text = "中华人民共和国";
63-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
64+
var geoText = new GeometryGeoText(x, y, text);
6465
var centroid = geoText.getCentroid();
6566
expect(centroid).not.toBeNull();
6667
expect(centroid.CLASS_NAME).toEqual("SuperMap.Geometry.Point");
@@ -74,7 +75,7 @@ describe('GeoText', function () {
7475
//根据绘制好的标签获取文字标签的像素范围,参数的单位是像素
7576
it('getLabelPxBoundsByLabel', function () {
7677
var x = 0, y = 0, text = "test";
77-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
78+
var geoText = new GeometryGeoText(x, y, text);
7879
var locationPixel = {X: 0, y: 0};
7980
var labelWidth = "100px";
8081
var labelHeight = "60px";
@@ -171,7 +172,7 @@ describe('GeoText', function () {
171172
// 根据文本内容获取文字标签的像素范围 处理斜体字
172173
it('getLabelPxBoundsByText_italic', function () {
173174
var x = 0, y = 0, text = "test";
174-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
175+
var geoText = new GeometryGeoText(x, y, text);
175176
var locationPixel = {X: 10, y: 10};
176177
var style = {
177178
fill: true,
@@ -266,7 +267,7 @@ describe('GeoText', function () {
266267
// 根据文本内容获取文字标签的像素范围 正常字体
267268
it('getLabelPxBoundsByText_normalontStyle', function () {
268269
var x = 0, y = 0, text = "test";
269-
var geoText = new SuperMap.Geometry.GeoText(x, y, text);
270+
var geoText = new GeometryGeoText(x, y, text);
270271
var locationPixel = {X: 10, y: 10};
271272
var style = {
272273
fill: true,
@@ -308,4 +309,4 @@ describe('GeoText', function () {
308309
expect(labelBounds.top).toEqual(1.8);
309310
geoText.destroy();
310311
});
311-
});
312+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy