Example #1
0
 /// <summary>
 /// Determines whether this section contains another.
 /// </summary>
 /// <param name="other">The other section.</param>
 /// <returns><c>true</c> if this instance contains <paramref name="other"/>; otherwise, <c>false</c>.</returns>
 public Boolean Contains(RasterSection other)
 {
     return(RowIndex <= other.RowIndex &&
            ColumnIndex <= other.ColumnIndex &&
            RowIndex + NumberOfRows >= other.RowIndex + other.NumberOfRows &&
            ColumnIndex + NumberOfColumns >= other.ColumnIndex + other.NumberOfColumns);
 }
Example #2
0
 /// <summary>
 /// Determines whether this section matches another.
 /// </summary>
 /// <param name="other">The other section.</param>
 /// <returns><c>true</c> if this instance has the same dimensions as <paramref name="other"/>; otherwise, <c>false</c>.</returns>
 public Boolean IsMatching(RasterSection other)
 {
     return(RowIndex == other.RowIndex &&
            ColumnIndex == other.ColumnIndex &&
            NumberOfRows == other.NumberOfRows &&
            NumberOfColumns == other.NumberOfColumns);
 }
        /// <summary>
        /// Adds the specified section to the map.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">The section is null.</exception>
        public Int32 AddSection(RasterSection section)
        {
            if (section == null)
            {
                throw new ArgumentNullException("section", "The section is null.");
            }

            if (section.RowIndex < 0 || section.ColumnIndex < 0 || section.Area == 0)
            {
                return(0);
            }

            foreach (RasterSection existingSection in _sections)
            {
                if (existingSection.IsMatching(section))
                {
                    section.Id = existingSection.Id;
                    return(section.Id);
                }
            }

            section.Id = _sections.Count + 1;
            _sections.Add(section);
            return(section.Id);
        }
        /// <summary>
        /// Adds the specified tile section to the map.
        /// </summary>
        /// <param name="section">The section.</param>
        /// <exception cref="System.ArgumentNullException">The section is null.</exception>
        public void AddTileSection(RasterSection section)
        {
            if (section == null)
            {
                throw new ArgumentNullException("section", "The section is null.");
            }



            if (section.Id == 0 || section.RowIndex < 0 || section.ColumnIndex < 0 || section.Area == 0)
            {
                return;
            }

            foreach (RasterSection existingSection in _tileSections)
            {
                if (existingSection.IsMatching(section))
                {
                    return;
                }
            }

            _tileSections.Add(section);
        }