Esempio n. 1
0
//		/// <summary>Imports the MapGeometry from its JSON representation.</summary>
//		/// <remarks>
//		/// Imports the MapGeometry from its JSON representation. M and Z values are
//		/// not imported from JSON representation.
//		/// See OperatorImportFromJson.
//		/// </remarks>
//		/// <param name="json">
//		/// The JSON representation of the geometry (with spatial
//		/// reference).
//		/// </param>
//		/// <returns>
//		/// The MapGeometry instance containing the imported geometry and its
//		/// spatial reference.
//		/// </returns>
//		public static com.epl.geometry.MapGeometry JsonToGeometry(com.fasterxml.jackson.core.JsonParser json)
//		{
//			com.epl.geometry.MapGeometry geom = com.epl.geometry.OperatorImportFromJson.Local().Execute(com.epl.geometry.Geometry.Type.Unknown, new com.epl.geometry.JsonParserReader(json));
//			return geom;
//		}
//
//		/// <summary>Imports the MapGeometry from its JSON representation.</summary>
//		/// <remarks>
//		/// Imports the MapGeometry from its JSON representation. M and Z values are
//		/// not imported from JSON representation.
//		/// See OperatorImportFromJson.
//		/// </remarks>
//		/// <param name="json">
//		/// The JSON representation of the geometry (with spatial
//		/// reference).
//		/// </param>
//		/// <returns>
//		/// The MapGeometry instance containing the imported geometry and its
//		/// spatial reference.
//		/// </returns>
//		public static com.epl.geometry.MapGeometry JsonToGeometry(com.epl.geometry.JsonReader json)
//		{
//			com.epl.geometry.MapGeometry geom = com.epl.geometry.OperatorImportFromJson.Local().Execute(com.epl.geometry.Geometry.Type.Unknown, json);
//			return geom;
//		}
//
//		/// <summary>Imports the MapGeometry from its JSON representation.</summary>
//		/// <remarks>
//		/// Imports the MapGeometry from its JSON representation. M and Z values are
//		/// not imported from JSON representation.
//		/// See OperatorImportFromJson.
//		/// </remarks>
//		/// <param name="json">
//		/// The JSON representation of the geometry (with spatial
//		/// reference).
//		/// </param>
//		/// <returns>
//		/// The MapGeometry instance containing the imported geometry and its
//		/// spatial reference.
//		/// </returns>
//		/// <exception cref="System.IO.IOException"></exception>
//		/// <exception cref="JsonParseException"></exception>
//		public static com.epl.geometry.MapGeometry JsonToGeometry(string json)
//		{
//			com.epl.geometry.MapGeometry geom = com.epl.geometry.OperatorImportFromJson.Local().Execute(com.epl.geometry.Geometry.Type.Unknown, json);
//			return geom;
//		}
//
//		/// <summary>Exports the specified geometry instance to it's JSON representation.</summary>
//		/// <remarks>
//		/// Exports the specified geometry instance to it's JSON representation.
//		/// See OperatorExportToJson.
//		/// </remarks>
//		/// <seealso cref="GeometryToJson(SpatialReference, Geometry)"/>
//		/// <param name="wkid">
//		/// The spatial reference Well Known ID to be used for the JSON
//		/// representation.
//		/// </param>
//		/// <param name="geometry">The geometry to be exported to JSON.</param>
//		/// <returns>The JSON representation of the specified Geometry.</returns>
//		public static string GeometryToJson(int wkid, com.epl.geometry.Geometry geometry)
//		{
//			return com.epl.geometry.GeometryEngine.GeometryToJson(wkid > 0 ? com.epl.geometry.SpatialReference.Create(wkid) : null, geometry);
//		}
//
//		/// <summary>Exports the specified geometry instance to it's JSON representation.</summary>
//		/// <remarks>
//		/// Exports the specified geometry instance to it's JSON representation. M
//		/// and Z values are not imported from JSON representation.
//		/// See OperatorExportToJson.
//		/// </remarks>
//		/// <param name="spatialReference">The spatial reference of associated object.</param>
//		/// <param name="geometry">The geometry.</param>
//		/// <returns>The JSON representation of the specified geometry.</returns>
//		public static string GeometryToJson(com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.Geometry geometry)
//		{
//			com.epl.geometry.OperatorExportToJson exporter = (com.epl.geometry.OperatorExportToJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToJson);
//			return exporter.Execute(spatialReference, geometry);
//		}
//
//		public static string GeometryToGeoJson(com.epl.geometry.Geometry geometry)
//		{
//			com.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson);
//			return exporter.Execute(geometry);
//		}
//
//		/// <summary>Imports the MapGeometry from its JSON representation.</summary>
//		/// <remarks>
//		/// Imports the MapGeometry from its JSON representation. M and Z values are
//		/// not imported from JSON representation.
//		/// See OperatorImportFromJson.
//		/// </remarks>
//		/// <param name="json">
//		/// The JSON representation of the geometry (with spatial
//		/// reference).
//		/// </param>
//		/// <returns>
//		/// The MapGeometry instance containing the imported geometry and its
//		/// spatial reference.
//		/// </returns>
//		/// <exception cref="System.IO.IOException"></exception>
//		/// <exception cref="JsonParseException"></exception>
//		public static com.epl.geometry.MapGeometry GeoJsonToGeometry(string json, int importFlags, com.epl.geometry.Geometry.Type type)
//		{
//			com.epl.geometry.MapGeometry geom = com.epl.geometry.OperatorImportFromGeoJson.Local().Execute(importFlags, type, json, null);
//			return geom;
//		}
//
//		/// <summary>Exports the specified geometry instance to its GeoJSON representation.</summary>
//		/// <remarks>
//		/// Exports the specified geometry instance to its GeoJSON representation.
//		/// See OperatorExportToGeoJson.
//		/// </remarks>
//		/// <seealso cref="GeometryToGeoJson(SpatialReference, Geometry)"/>
//		/// <param name="wkid">
//		/// The spatial reference Well Known ID to be used for the GeoJSON
//		/// representation.
//		/// </param>
//		/// <param name="geometry">The geometry to be exported to GeoJSON.</param>
//		/// <returns>The GeoJSON representation of the specified geometry.</returns>
//		public static string GeometryToGeoJson(int wkid, com.epl.geometry.Geometry geometry)
//		{
//			return com.epl.geometry.GeometryEngine.GeometryToGeoJson(wkid > 0 ? com.epl.geometry.SpatialReference.Create(wkid) : null, geometry);
//		}
//
//		/// <summary>Exports the specified geometry instance to it's JSON representation.</summary>
//		/// <remarks>
//		/// Exports the specified geometry instance to it's JSON representation.
//		/// See OperatorImportFromGeoJson.
//		/// </remarks>
//		/// <param name="spatialReference">The spatial reference of associated object.</param>
//		/// <param name="geometry">The geometry.</param>
//		/// <returns>The GeoJSON representation of the specified geometry.</returns>
//		public static string GeometryToGeoJson(com.epl.geometry.SpatialReference spatialReference, com.epl.geometry.Geometry geometry)
//		{
//			com.epl.geometry.OperatorExportToGeoJson exporter = (com.epl.geometry.OperatorExportToGeoJson)factory.GetOperator(com.epl.geometry.Operator.Type.ExportToGeoJson);
//			return exporter.Execute(spatialReference, geometry);
//		}

        /// <summary>Imports geometry from the ESRI shape file format.</summary>
        /// <remarks>
        /// Imports geometry from the ESRI shape file format.
        /// See OperatorImportFromESRIShape.
        /// </remarks>
        /// <param name="esriShapeBuffer">The buffer containing geometry in the ESRI shape file format.</param>
        /// <param name="geometryType">
        /// The required type of the Geometry to be imported. Use
        /// Geometry.Type.Unknown if the geometry type needs to be
        /// determined from the buffer content.
        /// </param>
        /// <returns>The geometry or null if the buffer contains null shape.</returns>
        /// <exception cref="GeometryException">
        /// when the geometryType is not Geometry.Type.Unknown and the
        /// buffer contains geometry that cannot be converted to the
        /// given geometryType. or the buffer is corrupt. Another
        /// exception possible is IllegalArgumentsException.
        /// </exception>
        public static com.epl.geometry.Geometry GeometryFromEsriShape(byte[] esriShapeBuffer, com.epl.geometry.Geometry.Type geometryType)
        {
            com.epl.geometry.OperatorImportFromESRIShape op = (com.epl.geometry.OperatorImportFromESRIShape)factory.GetOperator(com.epl.geometry.Operator.Type.ImportFromESRIShape);
            return(op.Execute(com.epl.geometry.ShapeImportFlags.ShapeImportNonTrusted, geometryType, new System.IO.MemoryStream(esriShapeBuffer)));
        }
 public static com.epl.geometry.ogc.OGCGeometry FromEsriShape(System.IO.MemoryStream buffer)
 {
     com.epl.geometry.OperatorImportFromESRIShape op = (com.epl.geometry.OperatorImportFromESRIShape)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.ImportFromESRIShape);
     com.epl.geometry.Geometry g = op.Execute(0, com.epl.geometry.Geometry.Type.Unknown, buffer);
     return(com.epl.geometry.ogc.OGCGeometry.CreateFromEsriGeometry(g, com.epl.geometry.SpatialReference.Create(4326)));
 }