예제 #1
0
        public object Clone()
        {
            FeatureObject feature = new FeatureObject();

            //20160810WMW添加
            if (LayerName != null)
            {
                feature.LayerName = LayerName.Clone() as string;
            }

            foreach (var item in Coordinates)
            {
                feature.Coordinates.Add(item);
            }

            feature.FeatureAttribute = FeatureAttribute.Table.Copy().NewRow();
            for (int i = 0; i < FeatureAttribute.ItemArray.Count(); i++)
            {
                feature.FeatureAttribute[feature.FeatureAttribute.Table.Columns[i].ColumnName] = FeatureAttribute.ItemArray[i];
            }

            return(feature);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }

            if (obj == null || !GetType().IsEquivalentTo(obj.GetType()))
            {
                return(false);
            }

            FeatureObject other = (FeatureObject)obj;

            if ((FeatureAttribute == null && other.FeatureAttribute != null) ||
                (FeatureAttribute != null && other.FeatureAttribute == null))
            {
                return(false);
            }
            else if ((Coordinates == null && other.Coordinates != null) ||
                     (Coordinates != null && other.Coordinates == null))
            {
                return(false);
            }
            else if ((string.IsNullOrEmpty(LayerName) && !string.IsNullOrEmpty(other.LayerName)) ||
                     (!string.IsNullOrEmpty(LayerName) && string.IsNullOrEmpty(other.LayerName)))
            {
                return(false);
            }
            else
            {
                return((FeatureAttribute != null ? System.Data.DataRowComparer.Default.Equals(FeatureAttribute, other.FeatureAttribute) : true) &&
                       (Coordinates != null ? Coordinates.SequenceEqual(other.Coordinates) : true) &&
                       (!string.IsNullOrEmpty(LayerName) ? string.CompareOrdinal(LayerName, other.LayerName) == 0 : true));
            }
        }