Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeometryComponentFilterImpl"/> class.
 /// </summary>
 /// <param name="sequencer">The sequencer.</param>
 internal GeometryComponentFilterImpl(LineSequencer sequencer)
 {
     this.sequencer = sequencer;
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeometryComponentFilterImpl"/> class.
 /// </summary>
 /// <param name="sequencer">The sequencer.</param>
 internal GeometryComponentFilterImpl(LineSequencer sequencer)
 {
     this.sequencer = sequencer;
 }
Пример #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="inputWKT"></param>
        /// <param name="expectedWKT"></param>
        private void RunLineSequencer(String[] inputWKT, String expectedWKT)      
        {
            try
            {
                IList<IGeometry> inputGeoms = FromWKT(inputWKT);
                LineSequencer sequencer = new LineSequencer();
                sequencer.Add(inputGeoms);

                if (!sequencer.IsSequenceable())
                    Assert.IsNull(expectedWKT);
                else
                {
                    IGeometry expected = rdr.Read(expectedWKT);
                    IGeometry result = sequencer.GetSequencedLineStrings();
                    bool isTrue = expected.EqualsExact(result);
                    Assert.IsTrue(isTrue);

                    bool isSequenced = LineSequencer.IsSequenced(result);
                    Assert.IsTrue(isSequenced);
                }
            }
            catch (Exception ex) { Debug.WriteLine(ex.ToString()); throw; }            
        }
Пример #4
0
        /// <summary>
        /// Takes the path returned from QuickGraph library and uses the 
        /// list of coordinates to reconstruct the path into a geometric 
        /// "shape"
        /// </summary>
        /// <param name="paths">Shortest path from the QucikGraph Library</param>
        /// <returns>
        /// A <see cref="ILineString"/> or a <see cref="IMultiLineString"/>
        /// with all the elements of the graph that composes the shortest path,
        /// sequenced using a <see cref="LineSequencer"/>.
        /// </returns>
        private IGeometry BuildString(ICollection<IEdge<ICoordinate>> paths)
        {
            // if the path has no links then return a null reference
            if (paths.Count < 1)
                return null;

            var collector = new LineSequencer();
            foreach (var path in paths)
            {
                var src = path.Source;
                var dst = path.Target;
                foreach (var str in strings)
                {
                    if (IsBound(str, src) && IsBound(str, dst))
                        collector.Add(str);
                }
            }

            var sequence = collector.GetSequencedLineStrings();
            return sequence;            
        }