Beispiel #1
0
 private static void ShowProjectedGeometryInfo(com.epl.geometry.MapGeometry mapGeom)
 {
     System.Console.Out.WriteLine("\n");
     com.epl.geometry.MapGeometry geom = mapGeom;
     // while ((geom = geomCursor.next()) != null) {
     if (geom.GetGeometry() is com.epl.geometry.Point)
     {
         com.epl.geometry.Point pnt = (com.epl.geometry.Point)geom.GetGeometry();
         System.Console.Out.WriteLine("Point(" + pnt.GetX() + " , " + pnt.GetY() + ")");
         if (geom.GetSpatialReference() == null)
         {
             System.Console.Out.WriteLine("No spatial reference");
         }
         else
         {
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
     }
     else
     {
         if (geom.GetGeometry() is com.epl.geometry.MultiPoint)
         {
             com.epl.geometry.MultiPoint mp = (com.epl.geometry.MultiPoint)geom.GetGeometry();
             System.Console.Out.WriteLine("Multipoint has " + mp.GetPointCount() + " points.");
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
         else
         {
             if (geom.GetGeometry() is com.epl.geometry.Polygon)
             {
                 com.epl.geometry.Polygon mp = (com.epl.geometry.Polygon)geom.GetGeometry();
                 System.Console.Out.WriteLine("Polygon has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                 if (mp.GetPathCount() > 1)
                 {
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                 }
                 System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
             }
             else
             {
                 if (geom.GetGeometry() is com.epl.geometry.Polyline)
                 {
                     com.epl.geometry.Polyline mp = (com.epl.geometry.Polyline)geom.GetGeometry();
                     System.Console.Out.WriteLine("Polyline has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                     System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
                 }
             }
         }
     }
 }