文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 04087a72 by 李景熙

Merge remote-tracking branch 'origin/develop' into develop

parents c241249b b62aa289
var baseURL = 'http://47.92.1.107/api'
let isTest = true
// let isTest = false
if (!isTest)
var baseURL = 'http://47.92.1.107/api'
else
var baseURL = 'http://localhost:9100/api'
export {
baseURL
......
......@@ -868,6 +868,7 @@ export default {
const newLabel = {
labelId: currentLabelId,
labelName: labelName,
correct: 0,
pointList: pointList
}
this.data[currentImageId].children.push(newLabel)
......
......@@ -204,7 +204,7 @@ export default {
let baseURL = this.baseURL
// 获取图片列表并转换格式
let imageList = await this.getLabelList()
// console.log(imageList)
console.log(imageList)
this.imageList = imageList.imageList
// 加载第一张图片
......@@ -276,6 +276,7 @@ export default {
// 还原数据库里的标注记录
let id = _this.pictureId
// console.log('id = ' + id)
// console.log(_this.data)
_this.data.forEach(function (element, index) {
var indexPic = index
......@@ -286,8 +287,13 @@ export default {
num.push(element1.Y)
})
_this.canvasAll[indexPic].push(num)
_this.canvasAllCheck.push(0)
_this.canvasAllCheck.push(element.correct)
if(element.correct == 0){
_this.value.push(false)
} else {
_this.value.push(true)
}
})
})
// 还原标注
......@@ -332,14 +338,19 @@ export default {
watch: {
value: function fn() {
var tmp = this.canvasAllCheck;
let _this = this
this.value.forEach((e, index) => {
if (tmp[index] == 0) {
if (e == true) {
_this.data[0].children[index].correct = 2;
tmp[index] = 2;
console.log(_this.data)
}
} else if (tmp[index] == 2) {
if (e == false) {
_this.data[0].children[index].correct = 0;
tmp[index] = 0;
console.log(_this.data)
}
}
})
......@@ -882,6 +893,7 @@ export default {
}
// pointList完成
const newLabel = {
correct: 1,
labelId: currentLabelId,
labelName: labelName,
pointList: pointList
......@@ -1053,6 +1065,7 @@ export default {
// _this.ctx.clearRect(0, 0, _this.canvas.width, _this.canvas.height)
_this.canvasAll[id].push(num)
_this.canvasAllCheck.push(1)
_this.value.push(false)
_this.restoreCanvas()
......@@ -1168,7 +1181,7 @@ export default {
})
// console.log('outputdata')
// console.log(outputData)
console.log(outputData)
this.submit()
......
......@@ -601,6 +601,7 @@ export default {
X: position.X,
Y: position.Y,
landmarkId: currentId,
correct: 0,
landmarkName: landmarkName
}
this.landmarkData.push(newlandmark)
......@@ -688,6 +689,7 @@ export default {
const newLabel = {
labelId: currentId,
labelName: labelName,
correct: 0,
pointList: pointList
}
this.layerData.push(newLabel)
......@@ -751,6 +753,7 @@ export default {
const newLabel = {
labelId: currentId,
labelName: labelName,
correct: 0,
pointList: pointList
}
this.layerData.push(newLabel)
......
......@@ -209,8 +209,12 @@ export default {
data () {
return {
computeScore: 0,
value: [],
value2: [],
value: [],// 地标checkbox
value2: [],// 区域标注checkbox
checkLayer: [], // 区域标注审核结果
checkLand: [], // 地标标注审核结果
layerData: null, // layerdata存放标注数据
landmarkData: null, // 存放地标数据
activeName: 'first',
isPoint: true,
centerX: 0,
......@@ -226,10 +230,7 @@ export default {
radio1: '地标',
activeIndex1: 1,
hasSaved: 1, // 保存标志
checkLayer: [],
checkLand: [],
layerData: null, // layerdata存放标注数据
landmarkData: null, // 存放地标数据
relationId: null, // 当前任务的relationID
clickedPosition: null, // 保存最新一次点击的结果,没有使用
map: null,
......@@ -258,19 +259,34 @@ export default {
// 避免第一次标注时数据库中没有内容的情况
if (res.layerInfo != null) {
this.layerData = res.layerInfo.labelList;
console.log('this.layerData')
console.log(this.layerData)
for (let i = 0;i < this.layerData.length;i++) {
this.checkLayer.push(0)
let tmpCorrect = this.layerData[i].correct
this.checkLayer.push(tmpCorrect)
if (tmpCorrect != 0) {
this.value2.push(true)
} else {
this.value2.push(false)
}
}
} else { this.layerData = [] }
// console.log(this.layerData)
if (res.landmarkList != null) {
this.landmarkData = res.landmarkList.landmarkEntityList;
console.log('this.landmarkData')
console.log(this.landmarkData)
for (let i = 0;i < this.landmarkData.length;i++) {
this.checkLand.push(0)
let tmpCorrect = this.landmarkData[i].correct
// alert(tmpCorrect)
this.checkLand.push(tmpCorrect)
if (tmpCorrect != 0) {
this.value.push(true)
} else {
this.value.push(false)
}
}
} else { this.landmarkData = [] }
// console.log(this.landmarkData)
......@@ -312,14 +328,26 @@ export default {
watch: {
value: function fn() {
var tmp = this.checkLand;
this.value.forEach((e, index) => {
console.log('tmp')
console.log(tmp[index])
console.log(e)
if (tmp[index] == 0) {
if (e == true) {
tmp[index] = 2;
this.landmarkData[index].correct = 2;
console.log('this.landmarkData[index]')
console.log(this.landmarkData[index])
}
} else if (tmp[index] == 2) {
if (e == false) {
tmp[index] = 0;
this.landmarkData[index].correct = 0;
console.log('this.landmarkData[index]')
console.log(this.landmarkData[index])
}
}
})
......@@ -332,10 +360,17 @@ export default {
if (tmp[index] == 0) {
if (e == true) {
tmp[index] = 2;
this.layerData[index].correct = 2;
console.log('this.layerData[index]')
console.log(this.layerData[index])
}
} else if (tmp[index] == 2) {
if (e == false) {
tmp[index] = 0;
this.layerData[index].correct = 0;
console.log('this.layerData[index]')
console.log(this.layerData[index])
}
}
})
......@@ -632,7 +667,8 @@ export default {
if (res.code === 1) {
let layerInfo = res.data.layerInfo
let landmarkList = res.data.landmarkList
// console.log(res.data)
console.log(res.data)
// 0是标注者标注错误的,1是标注者标注正确的,2是审核者自己添加的
return {
layerInfo: layerInfo,
landmarkList: landmarkList
......@@ -680,6 +716,7 @@ export default {
let newlandmark = {
X: position.X,
Y: position.Y,
correct: 1,
landmarkId: currentId,
landmarkName: landmarkName
}
......@@ -770,7 +807,8 @@ export default {
const newLabel = {
labelId: currentId,
labelName: labelName,
pointList: pointList
pointList: pointList,
correct: 1
}
this.layerData.push(newLabel)
this.checkLayer.push(1)
......@@ -835,7 +873,8 @@ export default {
const newLabel = {
labelId: currentId,
labelName: labelName,
pointList: pointList
pointList: pointList,
correct: 1
}
this.layerData.push(newLabel)
this.checkLayer.push(1)
......
......@@ -37,6 +37,7 @@ class Point(db.EmbeddedDocument):
class Label(db.EmbeddedDocument):
labelId = db.IntField(required=True)
labelName = db.StringField(required=True)
correct = db.IntField(required=True)
lineColor = db.ListField(db.IntField())
fillColor = db.ListField(db.IntField())
pointList = db.ListField(db.EmbeddedDocumentField(Point))
......@@ -44,6 +45,7 @@ class Label(db.EmbeddedDocument):
def to_json(self):
return {'labelId': self.labelId,
'labelName': self.labelName,
'correct': self.correct,
'pointList': [i.to_json() for i in self.pointList]
}
......@@ -83,6 +85,7 @@ def create_labels(label_list):
label = Label(
labelId=i['labelId'],
labelName=i['labelName'],
correct=i['correct'],
lineColor=list(c),
fillColor=list(c),
pointList=create_points(i['pointList'])
......@@ -145,11 +148,13 @@ def get_img_colors(relation_id):
# 获取标注图片的坐标列表
def get_img_point_lists(relation_id):
def get_img_point_lists(relation_id, label_filter=False):
obj = Image.objects(relationId=relation_id).first()
point_lists = []
label_list = obj['labelList']
for i in label_list:
if label_filter and i['correct'] == 0:
continue
points = i['pointList']
sub_list = []
for j in points:
......@@ -189,7 +194,7 @@ def export_original_img_bytes(relation_id):
# 根据relationId获取图片json对象
def export_img_json_bytes(relation_id):
def export_img_json_bytes(relation_id, label_filter=False):
try:
ret = {'version': '3.10.0', 'flags': {}}
obj = Image.objects(relationId=relation_id).first()
......@@ -201,15 +206,19 @@ def export_img_json_bytes(relation_id):
shapes = []
for i, line_color, fill_color in zip(label_list, line_colors, fill_colors):
if label_filter and i['correct'] == 0:
continue
shape = {}
label_name = i['labelName']
point_list = i['pointList']
correct = i['correct']
points = []
for j in point_list:
points.append([j['X'], j['Y']])
shape['label'] = label_name
shape['line_color'] = line_color
shape['fill_color'] = fill_color
shape['correct'] = correct
shape['points'] = points
shape['shape_type'] = 'polygon'
shapes.append(shape)
......@@ -250,7 +259,7 @@ def export_label_img_bytes(relation_id):
return Result(0, msg['errmsg'], {})
line_colors, fill_colors = get_img_colors(relation_id)
points_lists = get_img_point_lists(relation_id)
points_lists = get_img_point_lists(relation_id, True)
img = PIL.Image.new("RGBA", img_size, (0, 0, 0, 255))
draw = PIL.ImageDraw.Draw(img)
......@@ -342,12 +351,14 @@ def delete_layer(relation_id):
class LandmarkEntity(db.EmbeddedDocument):
landmarkId = db.IntField(required=True)
landmarkName = db.StringField()
correct = db.IntField(required=True)
X = db.FloatField(required=True)
Y = db.FloatField(required=True)
def to_json(self):
return {'landmarkId': self.landmarkId,
'landmarkName': self.landmarkName,
'correct': self.correct,
'X': self.X,
'Y': self.Y}
......@@ -372,6 +383,7 @@ def create_landmark_entities(landmark_entity_list):
landmark_entity = LandmarkEntity(
landmarkId=i['landmarkId'],
landmarkName=i['landmarkName'],
correct=i['correct'],
X=i['X'],
Y=i['Y']
)
......
......@@ -164,7 +164,7 @@ def export_zip(relationId):
# 3 files' Bytes
original_img_bytes = Image.export_original_img_bytes(relationId)
label_img_bytes = Image.export_label_img_bytes(relationId)
_, json_img_bytes = Image.export_img_json_bytes(relationId)
_, json_img_bytes = Image.export_img_json_bytes(relationId, True)
bytes = [original_img_bytes, json_img_bytes, label_img_bytes]
types = [image_name + '.' + img_type, image_name + '.json', image_name + '_label.' + img_type]
......@@ -205,8 +205,9 @@ def export_kml(relationId):
# "imageName": "tom@qq.com",
# "labelList": [
# {
# "labelId": 123,
# "labelId": 456,
# "labelName": "标注",
# "correct": 0,
# "pointList": [
# {
# "pointId": 14,
......@@ -216,23 +217,6 @@ def export_kml(relationId):
# ]
# }
# ]
# },
# {
# "relationId": 156,
# "imageName": "jerry@qq.com",
# "labelList": [
# {
# "labelId": 13,
# "labelName": "标注",
# "pointList": [
# {
# "pointId": 145,
# "X": 2.834,
# "Y": 145
# }
# ]
# }
# ]
# }
# ]
# }
......@@ -245,6 +229,7 @@ def export_kml(relationId):
# {
# "labelId": 181,
# "labelName": "label01",
# "correct": 0,
# "pointList": [
# {
# "pointId": 21,
......@@ -261,6 +246,7 @@ def export_kml(relationId):
# {
# "landmarkId": 31,
# "landmarkName": "landmark31",
# "correct": 0,
# "X": 31.1,
# "Y": 31.2
# }
......
......@@ -190,7 +190,18 @@ def getFileContent():
return json.dumps(return_dict, ensure_ascii=False)
url = result.get('textUrl')
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='UTF-8').read()
try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='utf-8').read()
except Exception as e:
try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='utf-16').read()
except Exception as e:
try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r').read()
except Exception as e:
return_dict['return_code'] = '203'
return_dict['return_info'] = '该编码的文本文法打开'
return json.dumps(return_dict, ensure_ascii=False)
# 后端传给前端 return_dict = {'return_code': '200', 'return_info': '处理成功', 'result': fileStr}
return_dict['result'] = fileStr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment