Esempio n. 1
0
        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature is covered by the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature is covered by the specified feature</returns>
        //public static bool CoveredBy(this IFeature self, IFeature other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).CoveredBy(Geometry.FromBasicGeometry(other));
        //}

        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature is covered by the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature is covered by the specified feature</returns>
        //public static bool CoveredBy(this IFeature self, IGeometry other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).CoveredBy((other));
        //}

        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature covers the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature covers the specified feature</returns>
        //public static bool Covers(this IFeature self, IFeature other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).Covers(Geometry.FromBasicGeometry(other));
        //}

        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature covers the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature covers the specified feature</returns>
        //public static bool Covers(this IFeature self, IGeometry other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).Covers(other);
        //}

        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature crosses the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature crosses the specified feature</returns>
        //public static bool Crosses(this IFeature self, IFeature other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).Crosses(Geometry.FromBasicGeometry(other));
        //}

        ///// <summary>
        ///// Gets a boolean that is true if the geometry of this feature crosses the geometry
        ///// of the specified feature
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The feature to compare this feature to</param>
        ///// <returns>Boolean, true if this feature crosses the specified feature</returns>
        //public static bool Crosses(this IFeature self, IGeometry other)
        //{
        //    return Geometry.FromBasicGeometry(self.Geometry).Crosses(other);
        //}

        ///// <summary>
        ///// Creates a new Feature that has a geometry that is the difference between this feature and the specified feature.
        ///// </summary>
        ///// <param name="self">This feature</param>
        ///// <param name="other">The other feature to compare to.</param>
        ///// <returns>A new feature that is the geometric difference between this feature and the specified feature.</returns>
        //public static IFeature Difference(this IFeature self, IFeature other)
        //{
        //    if (other == null) return self.Copy();
        //    IGeometry g = Geometry.FromBasicGeometry(self.Geometry).Difference(Geometry.FromBasicGeometry(other.Geometry));
        //    if (g == null) return null;
        //    if (g.IsEmpty) return null;
        //    return new Feature(g);
        //}

        /// <summary>
        /// Creates a new Feature that has a geometry that is the difference between this feature and the specified feature.
        /// </summary>
        /// <param name="self">This feature</param>
        /// <param name="other">The other feature to compare to.</param>
        /// <returns>A new feature that is the geometric difference between this feature and the specified feature.</returns>
        public static IFeature Difference(this IFeature self, IGeometry other)
        {
            if (other == null)
            {
                return(self.Copy());
            }
            IGeometry g = self.Geometry.Difference(other);

            if (g == null || g.IsEmpty)
            {
                return(null);
            }
            return(new Feature(g));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new Feature that has a geometry that is the difference between this feature and the specified feature.
        /// </summary>
        /// <param name="self">This feature</param>
        /// <param name="other">The other feature to compare to.</param>
        /// <returns>A new feature that is the geometric difference between this feature and the specified feature.</returns>
        public static IFeature Difference(this IFeature self, IGeometry other)
        {
            if (other == null)
            {
                return(self.Copy());
            }
            IGeometry g = Geometry.FromBasicGeometry(self.BasicGeometry).Difference(other);

            if (g == null)
            {
                return(null);
            }
            if (g.IsEmpty)
            {
                return(null);
            }
            return(new Feature(g));
        }
        /// <summary>
        /// Make fieldAttributes sub-set of fieldAttributes specific number of random elements from the selected
        /// feature layer in the map legend.
        /// </summary>
        /// <param name="pSampleSize">Number of elements to return</param>
        public static FeatureSet CreateRandomSelection(IFeatureLayer mLayer, int pSampleSize)
        {
            if (mLayer == null)
            {
                Utilities.LogDebug("The specified layer is null");
                return(null);
            }

            var         mRndFeatureSet = new FeatureSet();
            IFeatureSet mFeatureSet    = mLayer.DataSet;

            mRndFeatureSet.DataTable = mFeatureSet.DataTable.Clone();

            int mFeatureSetSize = mFeatureSet.Features.Count;

            Utilities.ResetRndGenerator();
            for (int i = 0; i < pSampleSize; i++)
            {
                IFeature mOldFeature = mFeatureSet.Features[Utilities.GetRndBetween(0, mFeatureSetSize)];
                IFeature mNewFeature = mRndFeatureSet.AddFeature(mOldFeature.Copy());
                mNewFeature.CopyAttributes(mOldFeature);
            }
            return(mRndFeatureSet);
        }