Browse Source

'多边形添加边框样式'

zhangyu 4 years ago
parent
commit
e6e551cd71

+ 26 - 3
src/lib/items/SFHFQZoneLegendItem.ts

@@ -143,9 +143,19 @@ export class SFHFQZoneLegendItem extends SPolygonItem {
             if (data.Properties.font) {
                 this.font = new SFont("sans-serif", data.Properties.font);
             }
-            //    if( data.Properties.LineDash){
-            //     this.LineDash =this._legend.Properties.LineDash
-            //    }
+            switch (data.Properties.LineDash) {
+                case "solid":
+                    this.lineStyle = SLineStyle.Solid;
+                    break;
+                case "dotted":
+                    this.lineStyle = SLineStyle.Dotted;
+                    break;
+                case "dashed":
+                    this.lineStyle = SLineStyle.Dashed;
+                    break;
+                default:
+                    this.lineStyle = SLineStyle.Solid;
+            }
         }
         // 监听多边形创建完成事件,并动态计算文本位置
         this.connect("finishCreated", this, () => {
@@ -166,6 +176,19 @@ export class SFHFQZoneLegendItem extends SPolygonItem {
         this.data.Properties.FillColor = this.fillColor.value;
         this.data.Properties.StrokeColor = this.strokeColor.value;
         this.data.Properties.LineWidth = this.lineWidth;
+        switch (this.lineStyle) {
+            case SLineStyle.Solid:
+                this.data.Properties.LineDash = "solid";
+                break;
+            case SLineStyle.Dotted:
+                this.data.Properties.LineDash = "dotted";
+                break;
+            case SLineStyle.Dashed:
+                this.data.Properties.LineDash = "dashed";
+                break;
+            default:
+                this.data.Properties.LineDash = "solid";
+        }
         this.data.OutLine = this.getPointList.map(pos => {
             return {
                 X: pos.x,

+ 26 - 3
src/lib/items/SSCPZZoneLegendItem.ts

@@ -151,9 +151,19 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
             if (data.Properties.font) {
                 this.font = new SFont("sans-serif", data.Properties.font);
             }
-            //    if( data.Properties.LineDash){
-            //     this.LineDash =this._legend.Properties.LineDash
-            //    }
+            switch (data.Properties.LineDash) {
+                case "solid":
+                    this.lineStyle = SLineStyle.Solid;
+                    break;
+                case "dotted":
+                    this.lineStyle = SLineStyle.Dotted;
+                    break;
+                case "dashed":
+                    this.lineStyle = SLineStyle.Dashed;
+                    break;
+                default:
+                    this.lineStyle = SLineStyle.Solid;
+            }
         }
         // 监听多边形创建完成事件,并动态计算文本位置
         this.connect("finishCreated", this, () => {
@@ -174,6 +184,19 @@ export class SSCPZZoneLegendItem extends SPolygonItem {
         this.data.Properties.FillColor = this.fillColor.value;
         this.data.Properties.StrokeColor = this.strokeColor.value;
         this.data.Properties.LineWidth = this.lineWidth;
+        switch (this.lineStyle) {
+            case SLineStyle.Solid:
+                this.data.Properties.LineDash = "solid";
+                break;
+            case SLineStyle.Dotted:
+                this.data.Properties.LineDash = "dotted";
+                break;
+            case SLineStyle.Dashed:
+                this.data.Properties.LineDash = "dashed";
+                break;
+            default:
+                this.data.Properties.LineDash = "solid";
+        }
         this.data.OutLine = this.getPointList.map(pos => {
             return {
                 X: pos.x,

+ 26 - 3
src/lib/items/SZoneLegendItem.ts

@@ -145,9 +145,19 @@ export class SZoneLegendItem extends SPolygonItem {
             if (data.Properties.font) {
                 this.font = new SFont("sans-serif", data.Properties.font);
             }
-            //    if( data.Properties.LineDash){
-            //     this.LineDash =this._legend.Properties.LineDash
-            //    }
+            switch (data.Properties.LineDash) {
+                case "solid":
+                    this.lineStyle = SLineStyle.Solid;
+                    break;
+                case "dotted":
+                    this.lineStyle = SLineStyle.Dotted;
+                    break;
+                case "dashed":
+                    this.lineStyle = SLineStyle.Dashed;
+                    break;
+                default:
+                    this.lineStyle = SLineStyle.Solid;
+            }
         }
         // 监听多边形创建完成事件,并动态计算文本位置
         this.connect("finishCreated", this, () => {
@@ -168,6 +178,19 @@ export class SZoneLegendItem extends SPolygonItem {
         this.data.Properties.FillColor = this.fillColor.value;
         this.data.Properties.StrokeColor = this.strokeColor.value;
         this.data.Properties.LineWidth = this.lineWidth;
+        switch (this.lineStyle) {
+            case SLineStyle.Solid:
+                this.data.Properties.LineDash = "solid";
+                break;
+            case SLineStyle.Dotted:
+                this.data.Properties.LineDash = "dotted";
+                break;
+            case SLineStyle.Dashed:
+                this.data.Properties.LineDash = "dashed";
+                break;
+            default:
+                this.data.Properties.LineDash = "solid";
+        }
         this.data.OutLine = this.getPointList.map(pos => {
             return {
                 X: pos.x,