tangxu
2023-11-12 8e7279907bb106a103d764d87a9ecf6ea200c93b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Text;
using System.Collections.Generic;
using System.Data;
using System.Runtime.Serialization;
using System.Linq;
 
namespace Hydro.Model
{
    [DataContract]
    public class Boundary2d
    {
        public Boundary2d() { }
        public Boundary2d(double minX, double maxX, double minY, double maxY)
        {
            this._minX = minX;
            this._maxX = maxX;
            this._minY = minY;
            this._maxY = maxY;
        }
        public Boundary2d(string strPara)
        {
            if (string.IsNullOrEmpty(strPara))
                return;
            string[] strPara_split_array = strPara.Split(',');
            if (strPara_split_array.Count() < 5)
                return  ;
            this._minX = Convert.ToDouble(strPara_split_array[1]);
            this._maxX = Convert.ToDouble(strPara_split_array[2]);
            this._minY = Convert.ToDouble(strPara_split_array[3]);
            this._maxY = Convert.ToDouble(strPara_split_array[4]);
        }
        public static Boundary2d ToParameter(string strPara)
        {
            if (string.IsNullOrEmpty(strPara))
                return null;
            string[] strPara_split_array = strPara.Split(',');
            if (strPara_split_array.Count() < 2)
                return null;
            Boundary2d pt = new Boundary2d();
            pt._minX = Convert.ToDouble(strPara_split_array[1]);
            pt._maxX = Convert.ToDouble(strPara_split_array[2]);
            pt._minY = Convert.ToDouble(strPara_split_array[3]);
            pt._maxY = Convert.ToDouble(strPara_split_array[4]);
            return pt;
        }
        #region MyRegion
        [DataMember]
        public double MinX
        {
            get { return _minX; }
            set { _minX = value; }
        }
        private double _minX;
 
        [DataMember]
        public double MaxX
        {
            get { return _maxX; }
            set { _maxX = value; }
        }
        private double _maxX;
 
        [DataMember]
        public double MinY
        {
            get { return _minY; }
            set { _minY = value; }
        }
        private double _minY;
 
        [DataMember]
        public double MaxY
        {
            get { return _maxY; }
            set { _maxY = value; }
        }
        private double _maxY; 
        #endregion
 
        public string ToDsString()
        {
            return ToDsString(this);
        }
 
        public static string ToDsString(Boundary2d point)
        {
            return string.Format("V1,{0},{1},{2},{3}", point._minX, point._maxX, point._minY, point._maxY);
        }
 
    }
}