李勇

1.白板标注模块优化标注删除,单个删除-->批量删除

此 diff 太大无法显示。
... ... @@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil';
import UTF8 from 'utf-8';
let loger = Loger.getLoger('MessageEntrance');
let _sdkInfo = {"version": "v.1.8.8.20170406", "author": "www.3mang.com"};
let _sdkInfo = {"version": "v.1.8.9.20170407", "author": "www.3mang.com"};
//APE
let _sass;
... ... @@ -155,7 +155,6 @@ export default class MessageEntrance extends Emiter {
//whiteBoradApe
this.sendInsertAnnotaion = this._sendInsertAnnotaion.bind(this);
//this.sendDeleteAnnotaion=this._sendDeleteAnnotaion;
this.sendDeleteAllAnnotation = this._sendDeleteAllAnnotation.bind(this);
this.sendDeleteCurPageAnnotation = this._sendDeleteCurPageAnnotation.bind(this);
this.sendGotoPrev = this._sendGotoPrev.bind(this);
... ... @@ -880,18 +879,6 @@ export default class MessageEntrance extends Emiter {
_whiteboard_ape.sendInsetAnnotaion(_param);
}
}
//删除标注,发送信息
_sendDeleteAnnotaion(_param) {
if (!_mcu.connected) {
loger.warn(GlobalConfig.getCurrentStatus());
return;
}
if (_whiteboard_ape) {
_whiteboard_ape.sendDeleteAnnotaion(_param);
}
}
//删除当前页面上的所有标注
_sendDeleteCurPageAnnotation(_param) {
if (!_mcu.connected) {
... ... @@ -1052,24 +1039,6 @@ export default class MessageEntrance extends Emiter {
this._sendDocumentUpload(paramInfo);
}
}
/* for (let value of GlobalConfig.docListPrepare) {
if (value) {
loger.log("判断是否需要把提前上传的文档上传到mcu", value);
let paramInfo = {
"pageNum": value.pdfSize,
"fileName": value.name,
"fileType": value.type,
"relativeUrl": value.relativeLocation,
"url": value.absoluteLocation,
"creatUserId": value.createUserID,
"docId": value.id,
"md5": value.MD5,
"visible": false
};
this._sendDocumentUpload(paramInfo);
}
}*/
}
}
... ...
... ... @@ -62,20 +62,18 @@ class WhiteBoardApe extends Ape {
// 添加标注,发送信息
sendInsetAnnotaion(_param) {
if (_param == null || EngineUtils.isEmptyObject(_param)) {
loger.log('sendInsetAnnotaion失败,参数错误');
loger.warn('添加标注失败->参数错误->',_param);
this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
return;
}
itemIdx = EngineUtils.creatSoleNumberFromTimestamp();
itemIdx = EngineUtils.creatSoleNumberFromTimestamp();//创建时间戳,保证每条数据的唯一
let whiteBoardModelPdu = this.packPdu(_param, itemIdx);
if (whiteBoardModelPdu == null) {
loger.log('sendInsetAnnotaion失败,参数错误');
loger.warn('添加标注失败-->参数错误->',_param);
this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG);
return;
}
//console.log(whiteBoardModelPdu);
//储存记录,用于返回上一步操作
this.insertHistory.push(whiteBoardModelPdu);
... ... @@ -87,8 +85,6 @@ class WhiteBoardApe extends Ape {
//insert
let tableInsertItemPdu = new pdu['RCRegistryTableInsertItemPdu'];
//optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU];
//repeated RCRegistryTableItemPdu items = 2;
tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_INSERT_PDU;//
tableInsertItemPdu.items.push(tableItemPdu);
... ... @@ -106,43 +102,79 @@ class WhiteBoardApe extends Ape {
adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
adapterPdu.item.push(adapterItemPdu);
loger.log("添加白板数据=====itemIdx=" + tableItemPdu.itemIdx);
loger.log("添加标注->itemIdx=" + tableItemPdu.itemIdx);
this.sendUniform(adapterPdu, true);
}
//撤销上一步
sendGotoPrev() {
loger.log("白板返回上一步");
loger.log("撤销上一步");
if (this.insertHistory == null || this.insertHistory.length < 1) {
loger.warn("无法继续上一步操作,已经没有可以撤销的数据");
return;
}
//loger.log(this.insertHistory);
this.sendDeleteAnnotaion(this.insertHistory.pop());
let annoItem=this.insertHistory.pop();
if(annoItem){
let temAnnos={};
temAnnos[annoItem.itemIdx]=annoItem;
this.sendDeleteAnnotaion({"itemIdxArr":temAnnos});
}
}
//删除当前页码的所有标注
sendDeleteCurPageAnnotation(_param) {
this.insertHistory=[];
let curPageAnnos={};
for (let key in this.annoInfos) {
let item = this.annoInfos[key];
if (item && item.parentId == GlobalConfig.activeDocId && item.curPageNo == GlobalConfig.activeDocCurPage) {
loger.log("sendDeleteCurPageAnnotation 删除当前页面上的标注", key);
this.sendDeleteAnnotaion({"itemIdx": key});
//loger.log("sendDeleteCurPageAnnotation 删除当前页面上的标注", key);
//this.sendDeleteAnnotaion({"itemIdx": key});
curPageAnnos[key]=item;
}
}
this.sendDeleteAnnotaion({"itemIdxArr":curPageAnnos});
}
//删除所有标注
sendDeleteAllAnnotation(_param) {
this.insertHistory=[];
for (let key in this.annoInfos) {
/* for (let key in this.annoInfos) {
this.sendDeleteAnnotaion({"itemIdx": key});
}
}*/
this.sendDeleteAnnotaion({"itemIdxArr":this.annoInfos});
}
//删除标注,发送信息
//删除标注,发送信息 {"itemIdxArr":{}}
sendDeleteAnnotaion(_param) {
if (_param == null||_param.itemIdxArr==null) {
loger.warn("要删除的数据不存在->",_param);
return;
}
let adapterPdu = new pdu['RCAdapterPdu'];
adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
for (let key in _param.itemIdxArr) {
let tableDeleteItemPdu = new pdu['RCRegistryTableDeleteItemPdu'];
tableDeleteItemPdu.type = pdu.RCPDU_REG_TABLE_DELETE_PDU;//
tableDeleteItemPdu.itemIdx = parseInt(key);//这里需要设置要删除的数据的itemIdx,每条数据的这个id都不一样
let updateObjPdu = new pdu['RCRegistryUpdateObjPdu'];
updateObjPdu.objId = ApeConsts.WHITEBOARD_OBJ_TABLE_ID;
updateObjPdu.subType = tableDeleteItemPdu.type;
updateObjPdu.userData = tableDeleteItemPdu.toArrayBuffer();
//同步
let adapterItemPdu = new pdu['RCAdapterItemPdu'];
adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ;
adapterItemPdu.itemData = updateObjPdu.toArrayBuffer();
adapterPdu.item.push(adapterItemPdu);
}
loger.log("发送删除白板标注数据->长度:" + adapterPdu.item.length);
this.sendUniform(adapterPdu, true);
}
/*sendDeleteAnnotaion(_param) {
if (_param == null) {
loger.warn("要删除的数据不存在");
return;
... ... @@ -168,9 +200,11 @@ class WhiteBoardApe extends Ape {
adapterPdu.type = pdu.RCPDU_REG_ADAPTER;
adapterPdu.item.push(adapterItemPdu);
loger.log("白板发送删除数据=============" + tableDeleteItemPdu.itemIdx);
loger.log("白板发送删除数据->" + tableDeleteItemPdu.itemIdx);
this.sendUniform(adapterPdu, true);
}
}*/
//更新标注
... ... @@ -182,7 +216,6 @@ class WhiteBoardApe extends Ape {
}
itemIdx = _param.itemIdx;
let whiteBoardModelPdu = this.packPdu(_param, itemIdx);
//console.log(whiteBoardModelPdu);
if (whiteBoardModelPdu == null) {
loger.log('sendInsetAnnotaion失败,参数错误');
... ... @@ -230,8 +263,7 @@ class WhiteBoardApe extends Ape {
loger.log(whiteBoardModel);
if (whiteBoardModel) {
if (GlobalConfig.activeDocId == whiteBoardModel.parentId && GlobalConfig.activeDocCurPage == whiteBoardModel.curPageNo) {
loger.log('WHITEBOARD_ANNOTAION_INSERT 显示到界面上', whiteBoardModel);
//this._emit(MessageTypes.WHITEBOARD_ANNOTAION_INSERT,whiteBoardModel);
//loger.log('显示新增的标注->');
this.insertAandShowAnnotaion(whiteBoardModel);
}
}
... ... @@ -266,7 +298,6 @@ class WhiteBoardApe extends Ape {
for (let i = 0; i < len; i++) {
if (this.annoInfos[itemIdxs[i]]) {
loger.log("删除白板数据:", itemIdxs[i]);
//this._emit(MessageTypes.WHITEBOARD_ANNOTAION_DELETE,{ "itemIdx":itemIdxs[i]});
delete this.annoInfos[itemIdxs[i]];
}
}
... ... @@ -311,7 +342,7 @@ class WhiteBoardApe extends Ape {
"isFresh": false,
"annotaionItems": annotaionItems
};
loger.log("WHITEBOARD_ANNOTATION_UPDATE", annotaionItems.length);
loger.log("新增一条标注数据->显示到界面");
this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj);
}
... ... @@ -331,7 +362,7 @@ class WhiteBoardApe extends Ape {
"isFresh": true,//清除现有显示的数据
"annotaionItems": annotaionItems //最新需要显示的数据
};
loger.log("清除标注---->重绘标注数量--->", annotaionItems.length,"当前文档信息--->DocId->",GlobalConfig.activeDocId,"curPageNo->",GlobalConfig.activeDocCurPage);
loger.log("清除当前显示的标注---->重绘标注数量--->", annotaionItems.length,"当前文档信息--->DocId->",GlobalConfig.activeDocId,"curPageNo->",GlobalConfig.activeDocCurPage);
this._emit(MessageTypes.WHITEBOARD_ANNOTATION_UPDATE, updateObj);
}
... ... @@ -369,9 +400,6 @@ class WhiteBoardApe extends Ape {
whiteBoardModelPdu.itemIdx = _itemIdx;
whiteBoardModelPdu.initiator = GlobalConfig.nodeId;
/* whiteBoardModelPdu.parentId=_param.parentId||0;
whiteBoardModelPdu.curPage=_param.curPage||1;*/
whiteBoardModelPdu.parentId = GlobalConfig.activeDocId;//当前激活的文档id
whiteBoardModelPdu.curPageNo = GlobalConfig.activeDocCurPage;//当前激活的文档页码
... ... @@ -386,8 +414,6 @@ class WhiteBoardApe extends Ape {
try {
loger.log("白板收到数据===unPackPdu ");
let whiteBoardModelPdu = pdu['RCWhiteBoardDataModelPdu'].decode(itemData);
//console.log(whiteBoardModelPdu);
//loger.log(whiteBoardModelPdu);
let _pointGroup = EngineUtils.arrayFromJsonString(whiteBoardModelPdu.pointGroup);
whiteBoardModelPdu.pointGroup = _pointGroup;
this.annoInfos[itemIdx] = whiteBoardModelPdu;
... ...