⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 miapi.cs

📁 mitab,读取MapInfo的地图文件
💻 CS
📖 第 1 页 / 共 2 页
字号:
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The brush foreground color (24 bits RGB value).</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_brush_fgcolor( IntPtr feature );

		/// <summary>
		/// Get an object's brush background color property. Applies to region, ellipse and rectangle objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The brush foreground color (24 bits RGB value).</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_brush_bgcolor( IntPtr feature );

		/// <summary>
		/// Get an object's brush pattern property. Applies to region, ellipse and rectangle objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The brush pattern number (1 is none, 2 is solid fill, etc.).</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_brush_pattern( IntPtr feature );

		/// <summary>
		/// Get an object's brush transparency property. Applies to region, ellipse and rectangle objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The brush transparency value, either 0 for an opaque brush (using bg color) or 1 for 
		/// transparent (ignore bg color).</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_brush_transparent( IntPtr feature );

		[DllImport("mitab.dll")]
		public static extern void mitab_c_set_font( IntPtr feature, 
			[MarshalAs(UnmanagedType.LPStr)] string font_name );

		/// <summary>
		/// Get the font name from a TABFC_Text or TABFC_FontPoint object, or the symbol name from a 
		/// TABFC_CustomPoint. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The text font name.</returns>
		[DllImport("mitab.dll", EntryPoint="mitab_c_get_font")]
		private static extern IntPtr _mitab_c_get_font( IntPtr feature );
		public static string mitab_c_get_font( IntPtr feature ) {
			return Marshal.PtrToStringAnsi(_mitab_c_get_font( feature ));
		}

//		[DllImport("mitab.dll")]
//		public static extern int mitab_c_get_font_vb( IntPtr feature, 
//			[MarshalAs(UnmanagedType.LPStr, SizeConst = 80)] string font, int l );

		[DllImport("mitab.dll")]
		public static extern void mitab_c_set_symbol( IntPtr feature, int symbol_no,
		   int symbol_size, int symbol_color );

		/// <summary>
		/// Get an object's symbol color property. Applies only to point and multipoint objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The symbol color (24 bits RGB value).</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_symbol_color( IntPtr feature );

		/// <summary>
		/// Get an object's symbol number property. Applies only to point and multipoint objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The symbol number (valid range: 32 to 67)</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_symbol_no( IntPtr feature );

		/// <summary>
		/// Get an object's symbol size property. Applies only to point and multipoint objects.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The symbol size in pixels (valid range 1 to 48)</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_symbol_size( IntPtr feature );

		[DllImport("mitab.dll")]
		public static extern void mitab_c_set_points( IntPtr feature, int part,
			int vertex_count, ref double x, ref double y );

		[DllImport("mitab.dll")]
		public static extern void mitab_c_set_arc( IntPtr feature, 
			double center_x, double center_y,
			double x_radius, double y_radius,
			double start_angle, double end_angle);

		/// <summary>
		/// Return a mitab_feature's object type. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>A member of the FeatureType enumeration, one of TABFC_NoGeom (0), TABFC_Point (1), 
		/// TABFC_FontPoint (2), TABFC_CustomPoint (3), TABFC_Text (4), TABFC_Polyline (5), TABFC_Arc (6),
		/// TABFC_Region (7), TABFC_Rectangle (8), TABFC_Ellipse (9) or TABFC_MultiPoint (10).</returns>
		[DllImport("mitab.dll")]
		public static extern FeatureType mitab_c_get_type( IntPtr feature );

		/// <summary>
		/// Return the number of parts (rings or polyline segments) in an object. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <returns>The number of parts (in a region or polyline) or 0 if the object's 
		/// geometry was not set. For all object types other than polyline region, returns 1 
		/// if object geometry is set.
		/// </returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_parts( IntPtr feature );

		/// <summary>
		/// Return the number of points in a part of a mitab_feature object. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <param name="part">The part number we are interested in. 
		/// Use 0 for objects which cannot have multiple parts.</param>
		/// <returns>The number of points in that feature's part or 0 if the object has no 
		/// geometry or the part number is invalid.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_vertex_count( IntPtr feature, int part );

		/// <summary>
		/// Return the X coordinate of a point in a part of a mitab_feature object.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <param name="part">The part number we are interested in. Use 0 for objects which cannot have multiple parts.</param>
		/// <param name="vertex">The point number, with 0 being the first point.</param>
		/// <returns>The X coordinate of the specified point or null if the object has no geometry or the part or the point number is invalid.</returns>
		[DllImport("mitab.dll")]
		public static extern double mitab_c_get_vertex_x( IntPtr feature, int part, int vertex );

		/// <summary>
		/// Return the Y coordinate of a point in a part of a mitab_feature object.
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <param name="part">The part number we are interested in. Use 0 for objects which cannot have multiple parts.</param>
		/// <param name="vertex">The point number, with 0 being the first point.</param>
		/// <returns>The Y coordinate of the specified point or null if the object has no geometry or the part or the point number is invalid.</returns>
		[DllImport("mitab.dll")]
		public static extern double mitab_c_get_vertex_y( IntPtr feature, int part, int vertex );

		/// <summary>
		/// Return the number of features in a dataset.
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <returns>The number of features in the dataset.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_feature_count( IntPtr handle );

		/// <summary>
		/// Return the number of attribute fields in a dataset's schema.
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <returns>The number of attribute fields defined in the dataset.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_field_count( IntPtr handle );
		
		/// <summary>
		/// Return the type of an attribute field in a dataset's schema. 
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>The field type, one of TABFT_Char (1), TABFT_Integer (2), TABFT_SmallInt (3),
		/// TABFT_Decimal (4), TABFT_Float (5), TABFT_Date (6), or TABFT_Logical (7)</returns>
		[DllImport("mitab.dll")]
		public static extern FieldType mitab_c_get_field_type( IntPtr handle, int field );
		
		/// <summary>
		/// Return the name of an attribute field in a dataset's schema. 
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>A pointer to the field name. The returned string pointer is a reference to an 
		/// internal buffer and should not be modified or freed by the caller.</returns>
		[DllImport("mitab.dll", EntryPoint="mitab_c_get_field_name")]
		private static extern IntPtr _mitab_c_get_field_name(IntPtr handle, int field);
		public static string mitab_c_get_field_name(IntPtr handle, int field) {
			return Marshal.PtrToStringAnsi( _mitab_c_get_field_name(handle, field) );
		}

//		[DllImport("mitab.dll")]
//		public static extern int mitab_c_get_field_name_vb( IntPtr handle, int field, 
//			[MarshalAs(UnmanagedType.LPStr, SizeConst = 80)] string name, int l );
		
		/// <summary>
		/// Return the width of an attribute field in a dataset's schema. 
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>The field width.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_field_width( IntPtr handle, int field );

		/// <summary>
		/// Return the precision of an attribute field in a dataset's schema. 
		/// </summary>
		/// <param name="handle">The dataset's handle.</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>The field precision.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_get_field_precision( IntPtr handle, int field );

		/// <summary>
		/// Fetch an attribute field value in a mitab_feature as a string.
		/// </summary>
		/// <remarks>The function returns a reference to an internal string buffer that contains the string 
		/// representation of the attribute field's value (integer and floating point values are converted 
		/// to string using sprintf()).</remarks>
		/// <param name="feature">The mitab_feature object</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>A pointer to a string containing the value of the field. The returned string pointer 
		/// is a reference to an internal buffer and should not be modified or freed by the caller. 
		/// Its value will be valid only until the next call to mitab_c_get_field().</returns>
		[DllImport("mitab.dll", EntryPoint="mitab_c_get_field_as_string")]
		private static extern IntPtr _mitab_c_get_field_as_string( IntPtr feature, int field );
		public static string mitab_c_get_field_as_string( IntPtr feature, int field ) {
			return Marshal.PtrToStringAnsi( _mitab_c_get_field_as_string( feature, field ));
		}


		/// <summary>
		/// Fetch an attribute field value in a mitab_feature as a double. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <param name="field">The index of the field to look at, with 0 being the first field.</param>
		/// <returns>The value of the field converted to double.</returns>
		[DllImport("mitab.dll")]
		public static extern double mitab_c_get_field_as_double( IntPtr feature, int field);

//		[DllImport("mitab.dll")]
//		public static extern int mitab_c_get_field_as_string_vb( IntPtr feature, int field, 
//			[MarshalAs(UnmanagedType.LPStr, SizeConst = 80)]  string value, int l );

		[DllImport("mitab.dll")]
		public static extern IntPtr mitab_c_get_projinfo( IntPtr dataset );
		
		[DllImport("mitab.dll")]
		public static extern int mitab_c_set_projinfo( IntPtr dataset, IntPtr projinfo );
		
		/// <returns>A pointer to a string</returns>
		[DllImport("mitab.dll", EntryPoint="mitab_c_get_mif_coordsys")]
		private static extern IntPtr _mitab_c_get_mif_coordsys(IntPtr dataset);
		public static string mitab_c_get_mif_coordsys(IntPtr dataset) {
			return Marshal.PtrToStringAnsi(_mitab_c_get_mif_coordsys(dataset));
		}
		

		///<returns>A pointer to a string</returns>
		[DllImport("mitab.dll", EntryPoint="mitab_c_get_extended_mif_coordsys")]
		private static extern IntPtr _mitab_c_get_extended_mif_coordsys(IntPtr dataset);
		public static string mitab_c_get_extended_mif_coordsys(IntPtr dataset) {
			return Marshal.PtrToStringAnsi(_mitab_c_get_extended_mif_coordsys(dataset));
		}

//		[DllImport("mitab.dll")]
//		public static extern int mitab_c_get_mif_coordsys_vb( IntPtr dataset, 
//			[MarshalAs(UnmanagedType.LPStr)] string coordsys, int l);

//		[DllImport("mitab.dll")]
//		public static extern int mitab_c_get_extended_mif_coordsys_vb( IntPtr dataset, 
//			[MarshalAs(UnmanagedType.LPStr)] string coordsys, int l);

		[DllImport("mitab.dll")]
		public static extern int mitab_c_load_coordsys_table(
			[MarshalAs(UnmanagedType.LPStr)] string filename);

		/// <summary>
		/// Return a false if the ring is the first of a polygon. 
		/// </summary>
		/// <param name="feature">The mitab_feature object.</param>
		/// <param name="requestedringindex">The requested ring index</param>
		/// <returns>True or false depends on the part number of the ring in the polygon, true if it's not the 
		/// first part of a polygon. If the feature is not a region the return value will be false.</returns>
		[DllImport("mitab.dll")]
		public static extern int mitab_c_is_interior_ring( IntPtr feature, int requestedringindex );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -