コード例 #1
0
        public static string ToWKT(this Esri.FileGDB.ShapeBuffer geometry)
        {
            try
            {
                string retval    = "";
                var    shapeType = (ShapeType)geometry.shapeType;
                //note: "M" values are not really supported. Relevant geometries are handled to extract Z values, if present.
                switch (shapeType)
                {
                case ShapeType.Multipoint:
                case ShapeType.MultipointZ:
                case ShapeType.MultipointZM:
                    MultiPointShapeBuffer mptbuff = geometry;
                    retval = processMultiPointBuffer(mptbuff);
                    break;

                case ShapeType.Point:
                case ShapeType.PointZ:
                case ShapeType.PointZM:
                    PointShapeBuffer pt = geometry;
                    retval = processPointBuffer(geometry);
                    break;

                case ShapeType.Polyline:
                case ShapeType.PolylineZ:
                case ShapeType.PolylineZM:
                    MultiPartShapeBuffer lbuff = geometry;
                    retval = processMultiPartBuffer(lbuff, "MULTILINESTRING");
                    break;

                case ShapeType.Polygon:
                case ShapeType.PolygonZ:
                case ShapeType.PolygonZM:
                    MultiPartShapeBuffer pbuff = geometry;
                    retval = processMultiPartBuffer(pbuff, "MULTIPOLYGON");
                    break;
                }
                return(retval);
            }
            catch (Exception ex)
            {
                throw new Exception("Error processing geometry", ex);
            }
        }
コード例 #2
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     try
     {
         string retval = "POINT ({0})";
         bool   hasZ   = false;
         try
         {
             hasZ = (buffer.Z != null);
         }
         catch
         {
             hasZ = false;
         }
         string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y);
         retval = string.Format(retval, coord);
         return(retval);
     }
     catch (Exception ex)
     {
         throw new Exception("Error processing point buffer", ex);
     }
 }
コード例 #3
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     try
     {
         StringBuilder retval = new StringBuilder("{\"type\":\"Point\", \"coordinates\": ");
         bool hasZ = false;
         try
         {
             hasZ = (buffer.Z != null); //this should always be true because a double is never null, but API throws and exception if no Z.
         }
         catch
         {
             hasZ = false;
         }
         string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y);
         retval.Append(coord);
         retval.Append("}");
         return retval.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("Error processing point buffer", ex);
     }
 }
コード例 #4
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     try
     {
         string retval = "POINT ({0})";
         bool hasZ = false;
         try
         {
             hasZ = (buffer.Z != null);
         }
         catch
         {
             hasZ = false;
         }
         string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y);
         retval = string.Format(retval, coord);
         return retval;
     }
     catch (Exception ex)
     {
         throw new Exception("Error processing point buffer", ex);
     }
 }
コード例 #5
0
        private static IMapPoint ToGeneralPoint(PointShapeBuffer point)
        {
            var pointGeo = new GeometryFactory().CreatePoint(point.point.x, point.point.y);

            return(pointGeo);
        }
コード例 #6
0
 private static IMapPoint ToGeneralPoint(PointShapeBuffer point)
 {
     var pointGeo = new GeometryFactory().CreatePoint(point.point.x, point.point.y);
     return pointGeo;
 }
コード例 #7
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     string retval = "{\"type\":\"Point\", \"coordinates\": ";
     retval += getCoordinate(buffer.point.x, buffer.point.y) + "}";
     return retval;
 }
コード例 #8
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     try
     {
         StringBuilder retval = new StringBuilder("{\"type\":\"Point\", \"coordinates\": ");
         bool hasZ = false;
         try
         {
             hasZ = (buffer.Z != null); //this should always be true because a double is never null, but API throws and exception if no Z.
         }
         catch
         {
             hasZ = false;
         }
         string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y);
         retval.Append(coord);
         retval.Append("}");
         return retval.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("Error processing point buffer", ex);
     }
 }
コード例 #9
0
 private static string processPointBuffer(PointShapeBuffer buffer)
 {
     string retval = "POINT ({0})";
     bool hasZ = false;
     try
     {
         hasZ = (buffer.Z != null);
     }
     catch
     {
         hasZ = false;
     }
     string coord = hasZ ? getCoordinate(buffer.point.x, buffer.point.y, buffer.Z) : getCoordinate(buffer.point.x, buffer.point.y);
     retval += string.Format(retval, coord);
     return retval;
 }