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);
|
}
|
|
}
|
}
|