Functions | Properties
Shapefile optimizations
Shapefile modules

Functions

bool Shapefile.BeginPointInShapefile ()
 Caches the coordinates of shapefile points for faster point in shape test.
void Shapefile.EndPointInShapefile ()
 Clears the cached data allocated by Shapefile.BeginPointInShapefile.
int Shapefile.get_numPoints (int ShapeIndex)
 Returns the number of points in the specified shape of the shapefile.
bool Shapefile.PointInShape (int ShapeIndex, double x, double y)
 Returns boolean value which indicates whether the given point is located within the specified shape.
int Shapefile.PointInShapefile (double x, double y)
 Returns a number which indicates the index of shapes within which a test point is situated.
Extents Shapefile.QuickExtents (int ShapeIndex)
 Returns the extents of the shape with the given index.
Point Shapefile.QuickPoint (int ShapeIndex, int PointIndex)
 Returns the specified point of shape.
System.Array Shapefile.QuickPoints (int ShapeIndex, ref int numPoints)
 Returns an array with the coordinates of points of the specified shape.
bool Shapefile.RefreshExtents ()
 Refreshes extents of all shapes in the shapefile.
bool Shapefile.RefreshShapeExtents (int ShapeId)
 Refreshes the extents of the particular shape in the shapefile.

Properties

bool Shapefile.CacheExtents [get, set]
 Gets or sets a boolean value which indicates whether extents of shape will be recalculated before each redraw.
bool Shapefile.FastMode [get, set]
 Gets or sets the value which indicates whether fast mode will be used for the shapefile.
int Shapefile.MinDrawingSize [get, set]
 Gets or sets the value which affects the drawing of small shapes on the screen.

Detailed Description

Here is a list of properties and methods which doesn't provide additional functionality but can improve the speed of certain operations with shapefile. This module is a part of the documentation of Shapefile class.

dot_inline_dotgraph_31.png

Graph description


Function Documentation

Caches the coordinates of shapefile points for faster point in shape test.

Shapefile.EndPointInShapefile call is needed to release the memory.

Returns:
True on successful caching and false otherwise.

Clears the cached data allocated by Shapefile.BeginPointInShapefile.

int Shapefile.get_numPoints ( int  ShapeIndex)

Returns the number of points in the specified shape of the shapefile.

This property is more efficient than calling Shapefile.get_Shape().NumPoints.

Parameters:
ShapeIndexThe index of the shape.
Returns:
The number of points or -1 in case of invalid index.

There is a confusion with name casing for this property. It's actually spelled 'get_NumPoints' in the source code. However because of the known bug in PIA generation process the property ended up spelled 'get_numPoints' in earlier version of PIAs. After some hesitation we decided to keep it that way. See description of the bug here: http://stackoverflow.com/questions/3179676/c-exposed-property-for-com-in-idl-is-showing-as-lower-case-all-of-a-sudden

bool Shapefile.PointInShape ( int  ShapeIndex,
double  x,
double  y 
)

Returns boolean value which indicates whether the given point is located within the specified shape.

The operation is applicable for polygon shapefiles only.

Parameters:
ShapeIndexThe index shape (polygon) to perform the test.
xX coordinate of the point.
yY coordinate of the point.
Returns:
True in case the point is located within polygon and false otherwise.
int Shapefile.PointInShapefile ( double  x,
double  y 
)

Returns a number which indicates the index of shapes within which a test point is situated.

Call Shapefile.BeginPointInShapefile to improve performance.

Parameters:
xThe x coordinate of the point.
yThe y coordinate of the point.
Returns:
The index of shape.
Extents Shapefile.QuickExtents ( int  ShapeIndex)

Returns the extents of the shape with the given index.

This operation is faster than Shapefile.get_Shape().Extents as there is no need to read all the shape data.

Parameters:
ShapeIndexThe index of the shape.
Returns:
The extents of shape or NULL reference on failure.
Point Shapefile.QuickPoint ( int  ShapeIndex,
int  PointIndex 
)

Returns the specified point of shape.

This operation doesn't require the reading of all shape date from disk, therefore it will be faster when editing mode is false.

Parameters:
ShapeIndexThe index of shape.
PointIndexThe point index.
Returns:
The point or the NULL reference on the invalid index.
System.Array Shapefile.QuickPoints ( int  ShapeIndex,
ref int  numPoints 
)

Returns an array with the coordinates of points of the specified shape.

The value specified in numPoints will be adjusted if the specified number is greater than the number of points.

Parameters:
ShapeIndexThe index of shape.
numPointsThe number of point to return.
Returns:
The array of double type with coordinates of the point. Every two elements represent x and y coordinate of the point respectively.

Refreshes extents of all shapes in the shapefile.

See Shapefile.CacheExtents for the details.

Returns:
The value can be omitted.
New API 4.8:
Added in version 4.8
bool Shapefile.RefreshShapeExtents ( int  ShapeId)

Refreshes the extents of the particular shape in the shapefile.

See Shapefile.CacheExtents for the details.

Parameters:
ShapeIdThe index of the shape which extents are to be refreshed.
Returns:
True on success and false in case of invalid shape index.
New API 4.8:
Added in version 4.8

Properties

bool Shapefile.CacheExtents [get, set]

Gets or sets a boolean value which indicates whether extents of shape will be recalculated before each redraw.

When the property is set to:

  • false: MapWinGIS recalculates the extents of each shape before the redraw assuming that some changes *MIGHT* took place. The operation can slow down the drawing for large shapefiles.

  • true: MapWinGIS doesn't recalculate extents of the shapes which leads to faster drawing but also makes a developer responsible for updating the extents of shapes in the due time. To do it one need to call Shapefile.RefreshShapeExtents after each editing operation. Otherwise there is a chance that old extents of the shape may lie outside the visible area of the map and the shape won't be displayed.

When Shapefile.FastMode is turned on the extents are cached automatically in spite of this property. Also the extents will be automatically refreshed after Shape.put_XY call. However Shape.get_Point().x = [value] call will not be tracked. Therefore Shapefile.RefreshShapeExtents will still be needed.

To avoid confusion use the following recommendation:

  1. If you work with small shapefile and performance isn't a problem, set this property to false.

  2. If the performance is an issue:
    • if you write a new code, set this property to true (as well as Shapefile.FastMode), but assign new coordinates to the points by calling Shape.put_XY only;
    • if you are bound to the exiting code with Shape.get_Point.x = [value] calls, set this property to true but call Shapefile.RefreshShapeExtents after the editing operations.
New API 4.8:
Added in version 4.8
bool Shapefile.FastMode [get, set]

Gets or sets the value which indicates whether fast mode will be used for the shapefile.

The mode ensures faster drawing but makes the client responsible for the refreshing of shapefile extents after editing operation (see Shapefile.RefreshExtents and Shapefile.RefreshShapeExtents). It's highly recommended to use the mode for large shapefiles.

New API 4.8:
Added in version 4.8
int Shapefile.MinDrawingSize [get, set]

Gets or sets the value which affects the drawing of small shapes on the screen.

The objects with scaled size less than this value will be drawn as a single dot. This can noticeably increase performance for large shapefiles at full scale. But with the increase of speed the quality of drawing will be deteriorating. The default value is 1.

New API 4.8:
Added in version 4.8
 All Classes Files Functions Enumerations Properties Events