map unit size

This commit is contained in:
copper 2022-06-22 10:22:37 +08:00
parent 274f6a3a10
commit 6d75db0867
3 changed files with 19 additions and 12 deletions

View File

@ -210,7 +210,7 @@ class InOnePlugin(BasicPlugin):
def set_action(self):
basic_diff_method_in_one = QAction('总流程')
basic_diff_method_in_one = QAction('差分法')
# ActionManager().change_detection_menu.addAction(basic_diff_method_in_one)
ActionManager().unsupervised_menu.addAction(basic_diff_method_in_one)
self.basic_diff_method_in_one = basic_diff_method_in_one
@ -498,6 +498,6 @@ def table_layer(pth,layer,name,send_message,dict):
result_layer = ResultPointLayer(out_csv, enable=True, proj=layer.proj, geo=layer.geo)
result_layer.result_path=dict
print(result_layer.result_path)
# print(result_layer.result_path)
layer.layer_parent.add_result_layer(result_layer)
send_message.emit('计算完成')

View File

@ -6,7 +6,7 @@ from threading import Thread
import numpy as np
from rscder.gui.actions import ActionManager
from rscder.plugins.basic import BasicPlugin
from rscder.gui.layercombox import RasterLayerCombox,ResultLayercombox
from rscder.gui.layercombox import RasterLayerCombox,ResultLayercombox, ResultPointLayerCombox
from PyQt5.QtWidgets import QAction, QFileDialog, QDialog, QLabel, QHBoxLayout, QVBoxLayout, QPushButton
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt
@ -29,8 +29,9 @@ class EvalutationDialog(QDialog):
self.setWindowTitle('精度评估')
self.setWindowIcon(IconInstance().LOGO)
self.layer_select = ResultLayercombox(self)
self.setMinimumWidth(500)
self.setMinimumHeight(150)
self.layer_select = ResultPointLayerCombox(self)
self.gt_file = None
gt_file_select_label = QLabel('真值文件:')
@ -42,7 +43,7 @@ class EvalutationDialog(QDialog):
hbox1.addWidget(self.gt_file_select)
hbox2 = QHBoxLayout()
# hbox2.addWidget(QLabel('二值化结果图层:'))
hbox2.addWidget(QLabel('二值化结果图层:'))
hbox2.addWidget(self.layer_select)
self.ok_button = QPushButton('确定', self)

View File

@ -493,12 +493,18 @@ class ResultPointLayer(BasicLayer):
lyr.enabled = True
lyr.fieldName = 'prob'
lyr.placement = QgsPalLayerSettings.OverPoint
lyr.xOffset = 25
lyr.yOffset = -2
lyr.textFont = QFont('Times New Roman', 100)
text_format = QgsTextFormat()
text_format.setFont(lyr.textFont)
text_format.setSize(50)
if self.geo is None:
res = 1
else:
res = self.geo[1]
# lyr.xOffset = 25 * res
# lyr.yOffset = -2 * res
text_format.setSize(50 * res)
text_format.setSizeUnit(QgsUnitTypes.RenderMapUnits)
text_format.setColor(QColor('#FF0000'))
# text_format.background().color = QColor('#000000')
text_format.buffer().setEnabled(True)
@ -560,7 +566,7 @@ class ResultPointLayer(BasicLayer):
if d[-1] == 0:
point.setAttribute('prob', '')
else:
point.setAttribute('prob', '%.2f'%(d[2]))
point.setAttribute('prob', '%.2f%%'%(d[2]))
# point.setAttribute('id', i)
features.append(point)
layer.addFeatures(features)
@ -582,7 +588,7 @@ class ResultPointLayer(BasicLayer):
if d[-1] == 0:
feature.setAttribute('prob', '')
else:
feature.setAttribute('prob', '%.2f'%(d[2]))
feature.setAttribute('prob', '%.2f%%'%(d[2]))
self.layer.updateFeature(feature)
else:
feature = self.layer.getFeature(row+1)
@ -593,7 +599,7 @@ class ResultPointLayer(BasicLayer):
if self.data[row][-1] == 0:
feature.setAttribute('prob', '')
else:
feature.setAttribute('prob', '%.2f'%(self.data[row][2]))
feature.setAttribute('prob', '%.2f%%'%(self.data[row][2]))
self.layer.updateFeature(feature)
self.layer.commitChanges()
Project().result_table.show_result(self)