Browse Source

航点字体

master
ctw 2 months ago
parent
commit
27c363640a
  1. 24
      ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java
  2. 8
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RouteWaypointsServiceImpl.java
  3. 10
      ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml
  4. 42
      ruoyi-ui/src/views/cesiumMap/index.vue
  5. 6
      ruoyi-ui/src/views/childRoom/index.vue
  6. 40
      ruoyi-ui/src/views/dialogs/WaypointEditDialog.vue

24
ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java

@ -63,6 +63,12 @@ public class RouteWaypoints extends BaseEntity
@Excel(name = "盘旋参数")
private String holdParams;
/** 航点标签文字大小(px),用于地图显示 */
private Integer labelFontSize;
/** 航点标签文字颜色(如 #333333),用于地图显示 */
private String labelColor;
public void setId(Long id)
{
this.id = id;
@ -179,6 +185,22 @@ public class RouteWaypoints extends BaseEntity
return holdParams;
}
public void setLabelFontSize(Integer labelFontSize) {
this.labelFontSize = labelFontSize;
}
public Integer getLabelFontSize() {
return labelFontSize;
}
public void setLabelColor(String labelColor) {
this.labelColor = labelColor;
}
public String getLabelColor() {
return labelColor;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -194,6 +216,8 @@ public class RouteWaypoints extends BaseEntity
.append("turnAngle", getTurnAngle())
.append("pointType", getPointType())
.append("holdParams", getHoldParams())
.append("labelFontSize", getLabelFontSize())
.append("labelColor", getLabelColor())
.toString();
}

8
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RouteWaypointsServiceImpl.java

@ -62,6 +62,14 @@ public class RouteWaypointsServiceImpl implements IRouteWaypointsService
routeWaypoints.setSeq((long) (maxSeq + 1));
}
// 2.5 地图标签默认值:字号 14、颜色 #333333(微软雅黑、不加粗)
if (routeWaypoints.getLabelFontSize() == null) {
routeWaypoints.setLabelFontSize(14);
}
if (routeWaypoints.getLabelColor() == null || routeWaypoints.getLabelColor().isEmpty()) {
routeWaypoints.setLabelColor("#333333");
}
// 3. 执行若依生成的原始插入方法
return routeWaypointsMapper.insertRouteWaypoints(routeWaypoints);
}

10
ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml

@ -17,10 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="turnAngle" column="turn_angle" />
<result property="pointType" column="point_type" />
<result property="holdParams" column="hold_params" />
<result property="labelFontSize" column="label_font_size" />
<result property="labelColor" column="label_color" />
</resultMap>
<sql id="selectRouteWaypointsVo">
select id, route_id, name, seq, lat, lng, alt, speed, start_time, turn_angle, point_type, hold_params from route_waypoints
select id, route_id, name, seq, lat, lng, alt, speed, start_time, turn_angle, point_type, hold_params, label_font_size, label_color from route_waypoints
</sql>
<select id="selectRouteWaypointsList" parameterType="RouteWaypoints" resultMap="RouteWaypointsResult">
@ -63,6 +65,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="turnAngle != null">turn_angle,</if>
<if test="pointType != null and pointType != ''">point_type,</if>
<if test="holdParams != null">hold_params,</if>
<if test="labelFontSize != null">label_font_size,</if>
<if test="labelColor != null">label_color,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="routeId != null">#{routeId},</if>
@ -76,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="turnAngle != null">#{turnAngle},</if>
<if test="pointType != null and pointType != ''">#{pointType},</if>
<if test="holdParams != null">#{holdParams},</if>
<if test="labelFontSize != null">#{labelFontSize},</if>
<if test="labelColor != null">#{labelColor},</if>
</trim>
</insert>
@ -93,6 +99,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="turnAngle != null">turn_angle = #{turnAngle},</if>
<if test="pointType != null">point_type = #{pointType},</if>
<if test="holdParams != null">hold_params = #{holdParams},</if>
<if test="labelFontSize != null">label_font_size = #{labelFontSize},</if>
<if test="labelColor != null">label_color = #{labelColor},</if>
</trim>
where id = #{id}
</update>

42
ruoyi-ui/src/views/cesiumMap/index.vue

@ -458,11 +458,11 @@ export default {
},
label: {
text: `WP${wpIndex}`,
font: '12px MicroSoft YaHei',
font: '14px Microsoft YaHei',
pixelOffset: new Cesium.Cartesian2(0, -20),
fillColor: Cesium.Color.WHITE,
fillColor: Cesium.Color.fromCssColorString('#333333'),
outlineColor: Cesium.Color.BLACK,
outlineWidth: 2,
outlineWidth: 1,
style: Cesium.LabelStyle.FILL_AND_OUTLINE
}
});
@ -483,13 +483,8 @@ export default {
if (positions.length > 0 && activeCursorPosition) return [...positions, activeCursorPosition];
return positions;
}, false),
width: 4,
//
material: new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.WHITE, //
gapColor: Cesium.Color.BLACK, //
dashLength: 20.0 //
}),
width: 3,
material: Cesium.Color.fromCssColorString('#800080'),
clampToGround: true
}
});
@ -562,7 +557,7 @@ export default {
name: 'HOLD',
position: this.missionPendingHold.center,
point: { pixelSize: 10, color: Cesium.Color.ORANGE, outlineColor: Cesium.Color.WHITE, outlineWidth: 2, disableDepthTestDistance: Number.POSITIVE_INFINITY },
label: { text: 'HOLD', font: '12px MicroSoft YaHei', fillColor: Cesium.Color.ORANGE, outlineColor: Cesium.Color.BLACK, outlineWidth: 2 }
label: { text: 'HOLD', font: '14px Microsoft YaHei', fillColor: Cesium.Color.ORANGE, outlineColor: Cesium.Color.BLACK, outlineWidth: 1 }
});
this.$emit('drawing-points-update', this.drawingPoints.length);
},
@ -933,7 +928,7 @@ export default {
const lineColor = lineStyle.color || '#800080';
const gapColor = lineStyle.gapColor != null ? lineStyle.gapColor : '#000000';
const dashLen = lineStyle.dashLength != null ? lineStyle.dashLength : 20;
const useDash = (lineStyle.style || 'dash') === 'dash';
const useDash = (lineStyle.style || 'solid') === 'dash';
const lineMaterial = useDash
? new Cesium.PolylineDashMaterialProperty({
color: Cesium.Color.fromCssColorString(lineColor),
@ -986,11 +981,11 @@ export default {
},
label: {
text: wp.name || `WP${index + 1}`,
font: `${Math.max(9, pixelSize + 2)}px MicroSoft YaHei`,
font: `${wp.labelFontSize != null ? Math.min(28, Math.max(10, Number(wp.labelFontSize))) : 14}px Microsoft YaHei`,
pixelOffset: new Cesium.Cartesian2(0, -Math.max(14, pixelSize + 8)),
fillColor: Cesium.Color.WHITE,
fillColor: Cesium.Color.fromCssColorString(wp.labelColor || '#333333'),
outlineColor: Cesium.Color.BLACK,
outlineWidth: 2,
outlineWidth: 1,
style: Cesium.LabelStyle.FILL_AND_OUTLINE
}
});
@ -1110,11 +1105,11 @@ export default {
},
label: {
text: wpName,
font: `${Math.max(9, pixelSize + 2)}px MicroSoft YaHei`,
font: `${wp.labelFontSize != null ? Math.min(28, Math.max(10, Number(wp.labelFontSize))) : 14}px Microsoft YaHei`,
pixelOffset: new Cesium.Cartesian2(0, -Math.max(14, pixelSize + 8)),
fillColor: Cesium.Color.WHITE,
fillColor: Cesium.Color.fromCssColorString(wp.labelColor || '#333333'),
outlineColor: Cesium.Color.BLACK,
outlineWidth: 2,
outlineWidth: 1,
style: Cesium.LabelStyle.FILL_AND_OUTLINE
}
});
@ -1626,12 +1621,21 @@ export default {
imageryProvider: false,
terrainProvider: new Cesium.EllipsoidTerrainProvider(),
baseLayer: false,
// canvas toDataURL
// CPU/GPU viewer.scene.requestRender()
requestRenderMode: true,
maximumRenderTimeChange: Infinity,
// canvas readPixels false
contextOptions: {
preserveDrawingBuffer: true
}
})
this.viewer.cesiumWidget.creditContainer.style.display = "none"
//
if (this.viewer.scene.requestRenderMode) {
this.viewer.entities.collectionChanged.addEventListener(() => {
this.viewer.scene.requestRender()
})
}
this.loadOfflineMap()
this.setup2DConstraints()
//

6
ruoyi-ui/src/views/childRoom/index.vue

@ -1087,7 +1087,7 @@ export default {
return;
}
// 2. pointTypeholdParams
// 2. pointTypeholdParams 14 #333333
const finalWaypoints = this.tempMapPoints.map((p, index) => ({
name: p.name || `WP${index + 1}`,
lat: p.lat,
@ -1096,6 +1096,8 @@ export default {
speed: p.speed != null ? p.speed : 800.0,
startTime: p.startTime || 'K+00:00:00',
turnAngle: p.turnAngle != null ? p.turnAngle : 0.0,
labelFontSize: p.labelFontSize != null ? p.labelFontSize : 14,
labelColor: p.labelColor || '#333333',
...(p.pointType && { pointType: p.pointType }),
...(p.holdParams != null && { holdParams: typeof p.holdParams === 'string' ? p.holdParams : JSON.stringify(p.holdParams) })
}));
@ -1194,6 +1196,8 @@ export default {
};
if (updatedWaypoint.pointType != null) payload.pointType = updatedWaypoint.pointType;
if (updatedWaypoint.holdParams != null) payload.holdParams = updatedWaypoint.holdParams;
if (updatedWaypoint.labelFontSize != null) payload.labelFontSize = updatedWaypoint.labelFontSize;
if (updatedWaypoint.labelColor != null) payload.labelColor = updatedWaypoint.labelColor;
const response = await updateWaypoints(payload);
if (response.code === 200) {
const index = this.selectedRouteDetails.waypoints.findIndex(p => p.id === updatedWaypoint.id);

40
ruoyi-ui/src/views/dialogs/WaypointEditDialog.vue

@ -14,6 +14,22 @@
<el-input v-model="formData.name" placeholder="请输入航点名称"></el-input>
</el-form-item>
<el-form-item label="地图文字大小" prop="labelFontSize">
<el-input-number
v-model="formData.labelFontSize"
:min="10"
:max="28"
controls-position="right"
placeholder="字号(px)"
style="width: 100%;"
/>
<div class="form-tip">航点名称在地图上的显示字号微软雅黑字体</div>
</el-form-item>
<el-form-item label="地图文字颜色" prop="labelColor">
<el-color-picker v-model="formData.labelColor" size="small" />
<span class="color-value">{{ formData.labelColor }}</span>
</el-form-item>
<el-form-item label="高度" prop="alt">
<el-input-number
v-model="formData.alt"
@ -137,7 +153,9 @@ export default {
holdSemiMajor: 500,
holdSemiMinor: 300,
holdHeadingDeg: 0,
holdClockwise: true
holdClockwise: true,
labelFontSize: 14,
labelColor: '#333333'
},
rules: {
name: [
@ -195,6 +213,8 @@ export default {
holdClockwise = p.clockwise !== false;
}
} catch (e) {}
const labelFontSize = this.waypoint.labelFontSize != null ? Number(this.waypoint.labelFontSize) : 14;
const labelColor = this.waypoint.labelColor || '#333333';
this.formData = {
name: this.waypoint.name || '',
alt: this.waypoint.alt !== undefined && this.waypoint.alt !== null ? Number(this.waypoint.alt) : 0,
@ -209,7 +229,9 @@ export default {
holdSemiMajor,
holdSemiMinor,
holdHeadingDeg,
holdClockwise
holdClockwise,
labelFontSize: Math.min(28, Math.max(10, labelFontSize)),
labelColor
};
this.$nextTick(() => {
@ -226,7 +248,13 @@ export default {
if (valid) {
const { minutesFromK, ...rest } = this.formData;
const startTimeStr = this.minutesToStartTime(minutesFromK);
const payload = { ...this.waypoint, ...rest, startTime: startTimeStr };
const payload = {
...this.waypoint,
...rest,
startTime: startTimeStr,
labelFontSize: this.formData.labelFontSize,
labelColor: this.formData.labelColor
};
if (this.formData.pointType && this.formData.pointType !== 'normal') {
payload.pointType = this.formData.pointType;
payload.holdParams = this.formData.pointType === 'hold_circle'
@ -362,4 +390,10 @@ export default {
margin-top: 4px;
line-height: 1.4;
}
.color-value {
margin-left: 8px;
font-size: 12px;
color: #606266;
}
</style>

Loading…
Cancel
Save