コード例 #1
0
        //MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))
        public static string ToWkt(LineChainBag2 <double> geom)
        {
            if (geom != null)
            {
                LineChain2 <double> cur;

                StringBuilder sb = new StringBuilder();
                sb.Append("MULTILINESTRING(");
                for (uint i = 0; i < geom.PartCount; i++)
                {
                    sb.Append('(');
                    cur = geom[i];

                    for (uint j = 0; j < cur.VertexCount; j++)
                    {
                        sb.Append(cur[j].X);
                        sb.Append(' ');
                        sb.Append(cur[j].Y);
                        sb.Append(',');
                    }
                    sb.Length = sb.Length - 1; //truncate last ,
                    sb.Append("),");
                }
                if (geom.PartCount > 0)
                {
                    sb[sb.Length - 1] = ')';
                }
                else
                {
                    sb.Append(')');
                }
                return(sb.ToString());
            }
            return(string.Empty);
        }
コード例 #2
0
 public LineChainBag2(LineChainBag2 <T> cloned)
 {
     if (cloned == null)
     {
         throw new ArgumentNullException();
     }
     this.Chains = cloned.Chains;
 }
コード例 #3
0
 public int CompareTo(LineChainBag2 <T> other)
 {
     if (other == null)
     {
         return(1);
     }
     if (object.ReferenceEquals(this, other))
     {
         return(0);
     }
     if (object.ReferenceEquals(this.Chains, other.Chains))
     {
         return(0);
     }
     return(this.Envelope.CompareTo(other.Envelope));
 }
コード例 #4
0
 public bool Equals(LineChainBag2 <T> other)
 {
     if (other == null)
     {
         return(false);
     }
     if (object.ReferenceEquals(this, other))
     {
         return(true);
     }
     if (object.ReferenceEquals(this.Chains, other.Chains))
     {
         return(true);
     }
     if (this.VertexCount.Equals(other.VertexCount) && this.Envelope.Equals(other.Envelope))
     {
         LineChain2 <T> us;
         LineChain2 <T> them;
         for (int i = 0; i < this.Chains.Length; i++)
         {
             us   = this.Chains[i];
             them = other.Chains[i];
             if (us.Points.Length != them.Points.Length)
             {
                 return(false); //can't be the same
             }
             for (int j = 0; j < us.Points.Length; j++)
             {
                 if (!us.Points[j].Equals(them.Points[j]))
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     return(false);
 }