Exemplo n.º 1
0
        public static string ToWkt(LineChainSet2 <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);
        }
Exemplo n.º 2
0
 public LineChainSet2(LineChainSet2 <T> other)
 {
     if (other == null)
     {
         throw new ArgumentNullException();
     }
     this.Chains = other.Chains;
 }
Exemplo n.º 3
0
 public int CompareTo(LineChainSet2 <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));
 }
Exemplo n.º 4
0
 public override bool Equals(object obj)
 {
     if (object.ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (object.ReferenceEquals(this, obj))
     {
         return(true);
     }
     if (obj is LineChainSet2 <T> )
     {
         LineChainSet2 <T> other = obj as LineChainSet2 <T>;
         if (other != null && this.Chains.Length == other.Chains.Length)
         {
             LineChain2 <T> curUs;
             LineChain2 <T> curThem;
             bool           match;
             for (int i = 0; i < this.Chains.Length; i++)
             {
                 match = false;
                 curUs = this.Chains[i];
                 for (int j = 0; j < other.Chains.Length; j++)
                 {
                     curThem = other.Chains[j];
                     if (curThem.Equals(curUs))
                     {
                         match = true;
                         break; //no point checking more
                     }
                 }
                 if (!match)
                 {
                     return(false); //didn't find a chain
                 }
             }
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 public bool Equals(LineChainSet2 <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);
 }