예제 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Points != null)
         {
             hashCode = hashCode * 59 + Points.GetHashCode();
         }
         if (FromPoints != null)
         {
             hashCode = hashCode * 59 + FromPoints.GetHashCode();
         }
         if (ToPoints != null)
         {
             hashCode = hashCode * 59 + ToPoints.GetHashCode();
         }
         if (OutArrays != null)
         {
             hashCode = hashCode * 59 + OutArrays.GetHashCode();
         }
         if (Vehicle != null)
         {
             hashCode = hashCode * 59 + Vehicle.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #2
0
        /// <summary>
        /// Returns true if MatrixRequest instances are equal
        /// </summary>
        /// <param name="input">Instance of MatrixRequest to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MatrixRequest input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Points == input.Points ||
                     Points != null &&
                     Points.SequenceEqual(input.Points)
                     ) &&
                 (
                     FromPoints == input.FromPoints ||
                     FromPoints != null &&
                     FromPoints.SequenceEqual(input.FromPoints)
                 ) &&
                 (
                     ToPoints == input.ToPoints ||
                     ToPoints != null &&
                     ToPoints.SequenceEqual(input.ToPoints)
                 ) &&
                 (
                     OutArrays == input.OutArrays ||
                     OutArrays != null &&
                     OutArrays.SequenceEqual(input.OutArrays)
                 ) &&
                 (
                     Vehicle == input.Vehicle ||
                     (Vehicle != null &&
                      Vehicle.Equals(input.Vehicle))
                 ));
        }
예제 #3
0
    public void ParseTest()
    {
        string d = "M2,173.3c0,47.3,19.2,90.1,50.2,121.1s73.8,50.2,121.1,50.2s90.1-19.2,121.1-50.2s50.2-73.8,50.2-121.1\n\ts-19.2-90.1-50.2-121.1S220.6,2,173.3,2S83.2,21.2,52.2,52.2S2,126,2,173.3z";

        List <string> testCommands = new List <string> ()
        {
            "M", "c", "s", "s", "s", "s", "S", "S", "S", "z"
        };

        List <float> testPoints = new List <float> ()
        {
            2.0f,
            173.3f,
            52.2f,
            294.4f,
            173.3f,
            344.6f,
            294.4f,
            294.4f,
            344.6f,
            173.3f,
            294.4f,
            52.2f,
            173.3f,
            2.0f,
            52.2f,
            52.2f,
            2.0f,
            173.3f
        };

        ToPoints svgPoints = new ToPoints();

        Assert.AreEqual(testCommands, svgPoints.GetCommands(d));

        List <PointData> test      = svgPoints.GetPointsFromPath(d).svgPoints;
        List <float>     resPoints = new List <float> ();

        for (int i = 0; i < test.Count; i++)
        {
            resPoints.Add(float.Parse(test [i].pos.x.ToString("N1")));
            resPoints.Add(float.Parse(test [i].pos.y.ToString("N1")));
        }

        Assert.AreEqual(testPoints, resPoints);
    }