コード例 #1
0
 /// <summary>
 /// This adds the coordinates and specifies what sort of feature type should be added.
 /// </summary>
 /// <param name="self">This IFeatureList</param>
 /// <param name="points">The list or array of coordinates to be added after it is built into the appropriate feature.</param>
 /// <param name="featureType">The feature type.</param>
 public static void Add(this IFeatureList self, IEnumerable <Coordinate> points, FeatureType featureType)
 {
     if (self.Parent.FeatureType == FeatureType.Unspecified)
     {
         self.Parent.FeatureType = featureType;
     }
     self.Add(points);
 }
コード例 #2
0
ファイル: FeatureListExt.cs プロジェクト: AlvaIce/GFJT-2020
 /// <summary>
 /// adding a single coordinate will assume that the feature type should be point for this featureset, even
 /// if it has not already been specified.
 /// </summary>
 /// <param name="self">This IFeatureList</param>
 /// <param name="point">The point to add to the featureset</param>
 /// <exception cref="FeatureTypeMismatchException">Thrown when the feature type already exists, there are already features in the featureset and the featuretype is not equal to point.</exception>
 public static void Add(this IFeatureList self, Coordinate point)
 {
     if (self.Parent.FeatureType != FeatureType.Point && self.Count > 0)
     {
         throw new FeatureTypeMismatchException();
     }
     self.Parent.FeatureType = FeatureType.Point;
     self.Add(new Feature(new Point(point)));
 }
コード例 #3
0
ファイル: FeatureListExt.cs プロジェクト: AlvaIce/GFJT-2020
        /// <summary>
        /// This method will attempt to add the specified geometry to the list.
        /// If the feature type is currently unspecified, this will specify the feature type.
        /// </summary>
        /// <param name="self">This feature list</param>
        /// <param name="geometry">The geometry to create a new feature from.</param>
        /// <exception cref="FeatureTypeMismatchException">Thrown if the new geometry does not match the currently specified feature type.  </exception>
        public static void Add(this IFeatureList self, IBasicGeometry geometry)
        {
            Feature f = new Feature(geometry);

            if (f.FeatureType != self.Parent.FeatureType && self.Parent.FeatureType != FeatureType.Unspecified)
            {
                throw new FeatureTypeMismatchException();
            }
            self.Add(f);
        }
コード例 #4
0
ファイル: FeatureSet.cs プロジェクト: hanchao/DotSpatial
        /// <summary>
        /// Initializes a new instance of the <see cref="FeatureSet"/> class.
        /// Creates a new FeatureSet using a given list of IFeatures.
        /// This will copy the existing features, rather than removing
        /// them from their parent feature set.
        /// </summary>
        /// <param name="inFeatures">
        /// The list of IFeatures
        /// </param>
        public FeatureSet(IList<IFeature> inFeatures)
            : this()
        {
            _dataTable = new DataTable();
            _dataTable.RowDeleted += DataTableRowDeleted;

            if (inFeatures.Count > 0)
            {
                FeatureType = inFeatures[0].FeatureType;
            }

            _features = new FeatureList(this);
            if (inFeatures.Count > 0)
            {
                if (inFeatures[0].ParentFeatureSet != null)
                {
                    CopyTableSchema(inFeatures[0].ParentFeatureSet);
                }
                else
                {
                    if (inFeatures[0].DataRow != null)
                    {
                        CopyTableSchema(inFeatures[0].DataRow.Table);
                    }
                }

                _features.SuspendEvents();
                foreach (IFeature f in inFeatures)
                {
                    IFeature myFeature = f.Copy();
                    _features.Add(myFeature);
                }

                _features.ResumeEvents();
            }
        }
コード例 #5
0
 /// <summary>
 /// Creates a new FeatureSet using a given list of IFeatures.
 /// This will copy the existing features, rather than removing
 /// them from their parent feature set.
 /// </summary>
 /// <param name="inFeatures">The list of IFeatures</param>
 public FeatureSet(IList<IFeature> inFeatures)
 {
     _progressHandler = Components.DataManager.DefaultDataManager.ProgressHandler;
     _progressMeter = new ProgressMeter(_progressHandler);
     _dataTable = new DataTable();
     _dataTable.RowDeleted += DataTableRowDeleted;
     
     if (inFeatures.Count > 0)
     {
         FeatureType = inFeatures[0].FeatureType;
     }
     _features = new FeatureList(this);
     if (inFeatures.Count > 0)
     {
         if (inFeatures[0].ParentFeatureSet != null)
         {
             CopyTableSchema(inFeatures[0].ParentFeatureSet);
         }
         else
         {
             if (inFeatures[0].DataRow != null)
             {
                 CopyTableSchema(inFeatures[0].DataRow.Table);
             }
         }
         _features.SuspendEvents(); 
         foreach (IFeature f in inFeatures)
         {
             IFeature myFeature = f.Copy();
             _features.Add(myFeature);
         }
         _features.ResumeEvents();
     }
 }
コード例 #6
0
 protected void FeaturesFromVertices()
 {
     _features = new FeatureList(this);
     _features.IncludeAttributes = false; // load these on demand later.
     _features.SuspendEvents();
     for (int shp = 0; shp < ShapeIndices.Count; shp++)
     {
         _features.Add(GetFeature(shp));
     }
     _features.ResumeEvents();
     _features.IncludeAttributes = true; // from this point on, any features that get added will also add a datarow to the data-Table.
 }