Skip to content

Commit 43ecc38

Browse files
committed
Merge branch 'master' of https://github.com/SuperMap/iClient-JavaScript into master
2 parents ae59e82 + 6eb7686 commit 43ecc38

File tree

7 files changed

+28
-18
lines changed

7 files changed

+28
-18
lines changed

src/common/overlay/knowledge-graph/format.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,9 @@ function getEdgeStyle(entity, style) {
100100
const types = JSON.parse(relationTypes || '[]');
101101
if (ids.includes(id) || types.includes(type)) {
102102
return {
103-
fontSize: compileFontSize(font.fontSize),
104-
fontFamily: font.fontName,
103+
fontSize: font.fontSize,
105104
fill: textColor,
106-
105+
...formatFontName(font.fontName),
107106
...formatFontStyle(font.fontStyle)
108107
};
109108
}
@@ -124,11 +123,10 @@ function getNodeStyle(entity, style) {
124123
if (ids.includes(id) || types.includes(labels[0])) {
125124
return {
126125
fillColor: color,
127-
fontSize: compileFontSize(font.fontSize),
128-
fontFamily: font.fontName,
126+
fontSize: font.fontSize,
129127
fill: textColor,
130128
size: size,
131-
// stroke: color,
129+
...formatFontName(font.fontName),
132130
...formatFontStyle(font.fontStyle)
133131
};
134132
}
@@ -153,18 +151,30 @@ function getNodeLabel(entity, captionField) {
153151
}
154152

155153
function formatFontStyle(fontStyle) {
156-
if (fontStyle === 1) {
157-
return { fontWeight: 600 };
154+
//TODO: fontStyle为0是plain
155+
if (fontStyle === 1 || fontStyle === 'bold') {
156+
return { fontWeight: 'bold' };
158157
}
159-
if (fontStyle === 2) {
158+
if (fontStyle === 2 || fontStyle === 'italic') {
160159
return { fontStyle: 'italic' };
161160
}
161+
if (fontStyle === 'bolditalic') {
162+
return { fontWeight: 'bold', fontStyle: 'italic' };
163+
}
162164
return {};
163165
}
164166

165-
function compileFontSize(fontSize) {
166-
return fontSize * 0.8;
167+
function formatFontName(fontName) {
168+
if (!fontName) {
169+
return {};
170+
}
171+
const arrs = fontName.split('.');
172+
return {
173+
fontFamily: arrs[0],
174+
...formatFontStyle(arrs[1])
175+
};
167176
}
177+
168178
// 处理graphMap数据的展开 折叠 隐藏的实体数据
169179
export function transformExpandCollapseHiddenData(graphMap) {
170180
const { expand, collapse, hidden } = graphMap.dataContent;

test/common/iServer/KnowledgeGraphServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('KnowledgeGraphService', () => {
4747
expect(result).not.toBeNull();
4848
expect(result.type).toBe('processCompleted');
4949
expect(result.result).not.toBeNull();
50-
expect(result.result.length).toEqual(2);
50+
expect(result.result.length).toEqual(4);
5151
knowledgeGraphService.destroy();
5252
done();
5353
} catch (exception) {

test/leaflet/services/KnowledgeGraphServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('KnowledgeGraphService', () => {
4242
expect(result).not.toBeNull();
4343
expect(result.type).toBe('processCompleted');
4444
expect(result.result).not.toBeNull();
45-
expect(result.result.length).toEqual(2);
45+
expect(result.result.length).toEqual(4);
4646
done();
4747
} catch (exception) {
4848
console.log("'query'案例失败:" + exception.name + ':' + exception.message);

test/mapboxgl/services/KnowledgeGraphServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('KnowledgeGraphService', () => {
4242
expect(result).not.toBeNull();
4343
expect(result.type).toBe('processCompleted');
4444
expect(result.result).not.toBeNull();
45-
expect(result.result.length).toEqual(2);
45+
expect(result.result.length).toEqual(4);
4646
done();
4747
} catch (exception) {
4848
console.log("'query'案例失败:" + exception.name + ':' + exception.message);

test/maplibregl/services/KnowledgeGraphServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('KnowledgeGraphService', () => {
4242
expect(result).not.toBeNull();
4343
expect(result.type).toBe('processCompleted');
4444
expect(result.result).not.toBeNull();
45-
expect(result.result.length).toEqual(2);
45+
expect(result.result.length).toEqual(4);
4646
done();
4747
} catch (exception) {
4848
console.log("'query'案例失败:" + exception.name + ':' + exception.message);

test/openlayers/services/KnowledgeGraphServiceSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('KnowledgeGraphService', () => {
4242
expect(result).not.toBeNull();
4343
expect(result.type).toBe('processCompleted');
4444
expect(result.result).not.toBeNull();
45-
expect(result.result.length).toEqual(2);
45+
expect(result.result.length).toEqual(4);
4646
done();
4747
} catch (exception) {
4848
console.log("'query'案例失败:" + exception.name + ':' + exception.message);

test/resources/knowledgeGraphService.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)