fix: 修正 Cesium 巡航车道中心对齐
This commit is contained in:
@@ -1452,6 +1452,7 @@ from qgis.core import (
|
||||
QgsApplication,
|
||||
QgsCoordinateReferenceSystem,
|
||||
QgsEditorWidgetSetup,
|
||||
QgsFieldConstraints,
|
||||
QgsFillSymbol,
|
||||
QgsMarkerSymbol,
|
||||
QgsMapRendererCustomPainterJob,
|
||||
@@ -1481,6 +1482,11 @@ try:
|
||||
except AttributeError:
|
||||
IMAGE_FORMAT = QImage.Format_ARGB32_Premultiplied
|
||||
|
||||
try:
|
||||
NOT_NULL_CONSTRAINT = QgsFieldConstraints.Constraint.ConstraintNotNull
|
||||
except AttributeError:
|
||||
NOT_NULL_CONSTRAINT = QgsFieldConstraints.ConstraintNotNull
|
||||
|
||||
def fill_symbol(color, outline="0,0,0,0", outline_width="0"):
|
||||
return QgsFillSymbol.createSimple({
|
||||
"color": color,
|
||||
@@ -1517,7 +1523,7 @@ def make_signal_layer():
|
||||
for field_name in ("signal_uid", "control_id", "approach_id", "source_way_id", "stop_lon", "stop_lat"):
|
||||
index = layer.fields().indexOf(field_name)
|
||||
if index >= 0:
|
||||
layer.setFieldConstraint(index, 1)
|
||||
layer.setFieldConstraint(index, NOT_NULL_CONSTRAINT)
|
||||
form = layer.editFormConfig()
|
||||
form.setReadOnly(index, True)
|
||||
layer.setEditFormConfig(form)
|
||||
|
||||
Reference in New Issue
Block a user