Sfoglia il codice sorgente

fix 里程格式|颜色调整

zhanghaijun 3 anni fa
parent
commit
a2dc22c354
3 ha cambiato i file con 20 aggiunte e 11 eliminazioni
  1. 10 9
      scripts/Common/DrawZdmAll.js
  2. 6 1
      scripts/Common/FileCTR.js
  3. 4 1
      scripts/Common/FileZDM.js

+ 10 - 9
scripts/Common/DrawZdmAll.js

@@ -11,6 +11,7 @@ include("scripts/Common/FileZDM.js");
 function DrawZdmAll(ratio) {
   // 比例尺
   this.ratio = ratio || 10.0;
+  this.frameColor = new RColor(255, 255, 0);
 }
 
 DrawZdmAll.prototype.applyPainting = function (layer, dmxFile, zdmFile, ctrFile, isCertCsv) {
@@ -33,27 +34,27 @@ DrawZdmAll.prototype.applyPainting = function (layer, dmxFile, zdmFile, ctrFile,
   // qsTr("桥梁 隧道") + " (*.ctr);"
   var fileCTR = new FileCTR(ctrFile, this.ratio);
   fileCTR.applyBridge(zdmData, dmxData, new RColor(31, 57, 197));
-  fileCTR.applyTunnel(zdmData, new RColor(255, 255, 0));
+  fileCTR.applyTunnel(zdmData, new RColor(0, 128, 0));
 
   // 以下开始绘画表格数据
   var extreme_dmx = this.getExtremePosition(zdmData.length > 0 ? zdmData : dmxData);
-  addPolylinetoView([extreme_dmx[0], extreme_dmx[2]], false, false, 0, new RColor(255, 255, 0));
-  addPolylinetoView([extreme_dmx[1], extreme_dmx[3]], false, false, 0, new RColor(255, 255, 0));
+  addPolylinetoView([extreme_dmx[0], extreme_dmx[2]], false, false, 0, this.frameColor);
+  addPolylinetoView([extreme_dmx[1], extreme_dmx[3]], false, false, 0, this.frameColor);
   var startPoint = extreme_dmx[2];
   var endPoint = extreme_dmx[3];
   var text_width = 260;
-  addPolylinetoView([[startPoint[0] - text_width, startPoint[1]], endPoint], false, false, 0, new RColor(255, 255, 0));
+  addPolylinetoView([[startPoint[0] - text_width, startPoint[1]], endPoint], false, false, 0, this.frameColor);
   var array = new Array();
   array.push({ name: "R", "space": 60, text: "竖曲线半径 (m)" });
   array.push({ name: "SJGC", "space": 100, text: "设计高程 (m)" });
   array.push({ name: "DMGC", "space": 100, text: "地面高程 (m)" });
   array.push({ name: "PDPC", "space": 100, text: "坡度 (%) 坡长 (m)" });
-  array.push({ name: "BLZH", "space": 120, text: "百里桩号 (m)" });
+  array.push({ name: "BLZH", "space": 120, text: "百里桩号 (km)" });
   for (var i = 0; i < array.length; i++) {
     var item = array[i];
     var space = (item.space || 100);
     var text = (item.text || "").toString();
-    addPolylinetoView([[startPoint[0] - text_width, startPoint[1] - space * (i + 1)], [endPoint[0], endPoint[1] - space * (i + 1)]], false, false, 0, new RColor(255, 255, 0));
+    addPolylinetoView([[startPoint[0] - text_width, startPoint[1] - space * (i + 1)], [endPoint[0], endPoint[1] - space * (i + 1)]], false, false, 0, this.frameColor);
     addSimpleTextToView(text, [startPoint[0] - text_width + 50, startPoint[1] - space * (i + 1) + 50], 15, 0, "宋体", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
     switch (item.name) {
       case "R":
@@ -73,8 +74,8 @@ DrawZdmAll.prototype.applyPainting = function (layer, dmxFile, zdmFile, ctrFile,
         break;
     }
     if (i == array.length - 1) {
-      addPolylinetoView([startPoint, [startPoint[0], startPoint[1] - space * (i + 1)]], false, false, 0, new RColor(255, 255, 0));
-      addPolylinetoView([endPoint, [endPoint[0], endPoint[1] - space * (i + 1)]], false, false, 0, new RColor(255, 255, 0));
+      addPolylinetoView([startPoint, [startPoint[0], startPoint[1] - space * (i + 1)]], false, false, 0, this.frameColor);
+      addPolylinetoView([endPoint, [endPoint[0], endPoint[1] - space * (i + 1)]], false, false, 0, this.frameColor);
     }
   }
   // 居中显示
@@ -101,7 +102,7 @@ DrawZdmAll.prototype.applyHeightMileage = function (arrayData, startPoint, space
   }
 }
 DrawZdmAll.prototype.applyMileage = function (arrayData, startPoint, space) {
-  spaceDistance = 0;
+  var spaceDistance = 0;
   var bailiDistance = 0;
   var tenBailiDistance = 0;
   for (var i = 0; i < arrayData.length; i++) {

+ 6 - 1
scripts/Common/FileCTR.js

@@ -133,7 +133,12 @@ FileCTR.prototype.applyBridge = function (zdmArrayData, dmxArrayData, PDColor) {
     }
     EAction.handleUserMessage("ctr-134: " + formatDateTime());
     addPolylinetoView([[middleZdm.x, middleZdm.y - 3], [middleDmx.x, middleDmx.y]], false, false, 0, PDColor);
-    addSimpleTextToView("K" + (bridgeMiddleX).toString(), [middleZdm.x, middleZdm.y + 6], 10, 90, "Standard", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
+    // 里程格式和ZDM里程格式一致
+    // 里程单位是km,格式应该为K000+000.000
+    var milestone = (round(bridgeMiddleX * 1000) / 1000);
+    var milestoneK = round(milestone / 1000);
+    addSimpleTextToView("K" + milestoneK.toString() + "+" + (milestone - milestoneK).toString(), [middleZdm.x + 9, middleZdm.y + 6], 10, 90, "Standard", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
+    addPolylinetoView([[middleZdm.x, middleZdm.y], [middleZdm.x, middleZdm.y + 50]], false, false, 0, PDColor);
   }
 };
 FileCTR.prototype.applyTunnel = function (zdmArrayData, PDColor) {

+ 4 - 1
scripts/Common/FileZDM.js

@@ -87,7 +87,10 @@ FileZDM.prototype.applyOperation = function () {
       TempLineData.push([this.newFZEntityData[i + 1][0], this.newFZEntityData[i + 1][1]]);
       addCircleToView(this.newFZEntityData[i + 1][0], this.newFZEntityData[i + 1][1], 0.5, 0, FZXColor);
       addLineToView([this.newFZEntityData[i + 1][0], this.newFZEntityData[i + 1][1] + 1.5], [this.newFZEntityData[i + 1][0], this.newFZEntityData[i + 1][1] + 50], 0);
-      addSimpleTextToView("K" + (round(this.newFZEntityData[i + 1][0] * 1000 * this.ratio) / 1000).toString(), [this.newFZEntityData[i + 1][0] - 9, this.newFZEntityData[i + 1][1] + 2.5], 7, 90, "Standard", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
+      // 里程单位是km,格式应该为K000+000.000
+      var milestone = (round(this.newFZEntityData[i + 1][0] * 1000 * this.ratio) / 1000);
+      var milestoneK = round(milestone / 1000);
+      addSimpleTextToView("K" + milestoneK.toString() + "+" + (milestone - milestoneK).toString(), [this.newFZEntityData[i + 1][0] - 9, this.newFZEntityData[i + 1][1] + 2.5], 7, 90, "Standard", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
       addSimpleTextToView(this.newFZEntityData[i + 1][1].toString(), [this.newFZEntityData[i + 1][0] + 2, this.newFZEntityData[i + 1][1] + 3], 7, 90, "Standard", RS.VAlignTop, RS.HAlignLeft, false, false, 0);
       // EAction.handleUserMessage("start point end point:" + this.newFZEntityData[i + 1][0] + "," + (this.newFZEntityData[i + 1][1]+1)+";"+this.newFZEntityData[i + 1][0]+","+ (this.newFZEntityData[i + 1][1]+10));
     }