public static IGeometry MergeLines(IGeometry g)
 {
     LineMerger merger = new LineMerger();
     merger.Add(g);
     IList<IGeometry> lines = merger.GetMergedLineStrings();
     return g.Factory.BuildGeometry(lines);
 }
 public static IGeometry mergeLines(Geometry g)
 {
     var merger = new LineMerger();
     merger.Add(g);
     var lines = merger.GetMergedLineStrings();
     return g.Factory.BuildGeometry(lines);
 }
 private static IGeometry DissolveLines(IGeometry lines)
 {
     IGeometry dissolved = lines.Union();
     LineMerger merger = new LineMerger();
     merger.Add(dissolved);
     IList<IGeometry> mergedColl = merger.GetMergedLineStrings();
     IGeometry merged = lines.Factory.BuildGeometry(mergedColl);
     return merged;
 }
		internal virtual void Run()
		{
			IList<IGeometry> lineStrings = Data;
			
			LineMerger lineMerger = new LineMerger();
			lineMerger.Add(lineStrings);
		    var mergedLineStrings = lineMerger.GetMergedLineStrings();
			
			Console.WriteLine("Lines formed (" + mergedLineStrings.Count + "):");
            foreach (var obj in mergedLineStrings)
			    Console.WriteLine(obj);
		}
Пример #5
0
        public static IList<IGeometry> GetContours(ref DotSpatial.Data.Raster rst, double[] x, double[] y, double zlev)
        {
            List<LineString> lsList = new List<LineString>();

            bool ipari, jpari;
            double[] xx = new double[3];
            double[] yy = new double[3];
            double[] zz = new double[3];

            for (int j = 0; j < rst.NumColumns - 1; j++)
            {
                if (((int)((double)j / 2.0)) * 2 == j)
                    jpari = true;
                else
                    jpari = false;

                for (int i = 0; i < rst.NumRows - 1; i++)
                {
                    if (((int)((double)i / 2.0)) * 2 == i)
                        ipari = true;
                    else
                        ipari = false;

                    if (!jpari && !ipari || jpari && ipari)
                    {
                        xx[0] = x[j];
                        yy[0] = y[i];
                        zz[0] = rst.Value[i, j];

                        xx[1] = x[j];
                        yy[1] = y[i + 1];
                        zz[1] = rst.Value[i + 1, j];

                        xx[2] = x[j + 1];
                        yy[2] = y[i];
                        zz[2] = rst.Value[i, j + 1];

                        {
                            Coordinate[] c = Intersect(xx, yy, zz, zlev);
                            if (c != null)
                            {
                                lsList.Add(new LineString(c));
                            }
                        }

                        xx[0] = x[j + 1];
                        yy[0] = y[i];
                        zz[0] = rst.Value[i, j + 1];

                        xx[1] = x[j];
                        yy[1] = y[i + 1];
                        zz[1] = rst.Value[i + 1, j];

                        xx[2] = x[j + 1];
                        yy[2] = y[i + 1];
                        zz[2] = rst.Value[i + 1, j + 1];

                        {
                            Coordinate[] c = Intersect(xx, yy, zz, zlev);
                            if (c != null)
                            {
                                lsList.Add(new LineString(c));
                            }
                        }
                    }

                    if (jpari && !ipari || !jpari && ipari)
                    {
                        xx[0] = x[j];
                        yy[0] = y[i];
                        zz[0] = rst.Value[i, j];

                        xx[1] = x[j];
                        yy[1] = y[i + 1];
                        zz[1] = rst.Value[i + 1, j];

                        xx[2] = x[j + 1];
                        yy[2] = y[i + 1];
                        zz[2] = rst.Value[i + 1, j + 1];

                        {
                            Coordinate[] c = Intersect(xx, yy, zz, zlev);
                            if (c != null)
                            {
                                lsList.Add(new LineString(c));
                            }
                        }

                        xx[0] = x[j];
                        yy[0] = y[i];
                        zz[0] = rst.Value[i, j];

                        xx[1] = x[j + 1];
                        yy[1] = y[i + 1];
                        zz[1] = rst.Value[i + 1, j + 1];

                        xx[2] = x[j + 1];
                        yy[2] = y[i];
                        zz[2] = rst.Value[i, j + 1];

                        {
                            Coordinate[] c = Intersect(xx, yy, zz, zlev);
                            if (c != null)
                            {
                                lsList.Add(new LineString(c));
                            }
                        }
                    }
                }
            }

            LineMerger lm = new LineMerger();

            lm.Add(lsList);

            IList<IGeometry> merged = (IList<IGeometry>)lm.GetMergedLineStrings();

            return merged;
        }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="container"></param>
 public AnonymousGeometryComponentFilterImpl(LineMerger container)
 {
     _container = container;
 }
Пример #7
0
 public static void DoTest(String[] inputWKT, String[] expectedOutputWKT, bool compareDirections)
 {
     LineMerger lineMerger = new LineMerger();
     lineMerger.Add(ToGeometries(inputWKT));
     Compare(ToGeometries(expectedOutputWKT), lineMerger.GetMergedLineStrings(), compareDirections);
 }
Пример #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="container"></param>
 public AnonymousGeometryComponentFilterImpl(LineMerger container)
 {
     _container = container;
 }