Public Member Functions | Properties
ShapefileCategories Class Reference

Represents a list of visualization categories which determine the appearance of the shapefile. More...

List of all members.

Public Member Functions

ShapefileCategory Add (string Name)
 Creates a new visualization category, adds it to the list and returns its reference to the caller.
void Add2 (ShapefileCategory Category)
 Adds the category to the collection.
bool AddRange (int FieldIndex, tkClassificationType ClassificationType, int numClasses, object MinValue, object MaxValue)
 Creates the specified number of visualization categories and expressions for them.
void ApplyColorScheme (tkColorSchemeType Type, ColorScheme ColorScheme)
 Applies color scheme to the visualization categories.
void ApplyColorScheme2 (tkColorSchemeType Type, ColorScheme ColorScheme, tkShapeElements ShapeElement)
 Applies color scheme to the visualization categories.
void ApplyColorScheme3 (tkColorSchemeType Type, ColorScheme ColorScheme, tkShapeElements ShapeElement, int CategoryStartIndex, int CategoryEndIndex)
 Applies color scheme to the visualization categories.
void ApplyExpression (int CategoryIndex)
 Maps particular shapes to the category based on ShapefileCategory.Expression.
void ApplyExpressions ()
 Maps shapes to the visualization categories based in ShapefileCategory.Expression.
void Clear ()
 Removes all the categories from the list.
void Deserialize (string newVal)
 Restores the state of the object from the string.
bool Generate (int FieldIndex, tkClassificationType ClassificationType, int numClasses)
 Generates visualization categories by certain attribute.
bool Generate2 (string FieldName, tkClassificationType ClassificationType, int numClasses)
 Generates categories based on specified field.
bool GeneratePolygonColors (ColorScheme Scheme=null)
 Applies specific coloring to polygon layer based on 2 rules:
int get_CategoryIndex (ShapefileCategory Category)
 Gets index of the specified category within a collection.
int get_CategoryIndexByName (string categoryName)
 Gets index of category by its name. The comparison is case-sensitive.
string get_ErrorMsg (int ErrorCode)
 Gets the description of the specific error code.
ShapefileCategory get_Item (int Index)
 Returns the category with the specified index.
ShapefileCategory Insert (int Index, string Name)
 Creates a new visualization category and inserts it at specified position of the list.
bool Insert2 (int Index, ShapefileCategory Category)
 Inserts a category at the specified index in the collection.
bool MoveDown (int Index)
 Moves the specified category down the list by swapping it with the succeeding category.
bool MoveUp (int Index)
 Moves the specified category up the list by swapping it with the preceding category.
bool Remove (int Index)
 Removes the specified category.
string Serialize ()
 Saves the state of the object to the string.
void set_Item (int Index, ShapefileCategory pVal)
 Replaces the category with the specified index with the new one.

Properties

string Caption [get, set]
 The name of the classification scheme to display in the legend.
int ClassificationField [get, set]
 Gets or sets the index of classification that was used to generate categories.
int Count [get]
 Returns the number of the categories in the list.
ICallback GlobalCallback [get, set]
 Gets or sets the callback object which is used to return to the client the information about progress and errors.
string Key [get, set]
 A text string associated with the instance of the class. Any value can be stored by developer in this property.
int LastErrorCode [get]
 Retrieves the numeric code of the last error that took place in the class.
Shapefile Shapefile [get]
 A reference to the parent shapefile.

Detailed Description

Represents a list of visualization categories which determine the appearance of the shapefile.

Provides methods for:

Here is a diagram for the ShapefileCategories class.

dot_inline_dotgraph_62.png

Graph description

New API 4.8:
Added in version 4.8

Member Function Documentation

Creates a new visualization category, adds it to the list and returns its reference to the caller.

It's the responsibility of the developer to map the new category to the particular shape by either:

Parameters:
NameThe name of the new category. It must not be unique.
Returns:
The reference to the newly created category or NULL reference on failure.
Examples:
MinimalDistance.cs, and PointIcons.cs.

Adds the category to the collection.

Parameters:
CategoryThe category.
New API 4.9.4:
Added in version 4.9.4
bool ShapefileCategories.AddRange ( int  FieldIndex,
tkClassificationType  ClassificationType,
int  numClasses,
object  MinValue,
object  MaxValue 
)

Creates the specified number of visualization categories and expressions for them.

The method can be useful to override generation routine provided in ShapefileCategories.GenerateCategories() which always generate categories covering the full range of values of the specified field. This method can define the range of values explicitly, therefore certain values can be excluded from classification or on contrary categories can be added for the values which aren't yet present in the table.

Parameters:
FieldIndexThe index of the field to build classification by.
ClassificationTypeThe type of the classification.
numClassesThe number of categories to add. If ClassificationType equals ctUniqueValues this value will be skipped.
MinValueThe minimal value of the field to include in the classification.
MaxValueTh maximum value of the field to include in the classification.
Returns:
True on successful adding and false otherwise.
Examples:
AddCategoryRange.cs.

Applies color scheme to the visualization categories.

Parameters:
TypeThe method of interpolation.
ColorSchemeColor scheme to take colors from.
Examples:
CreateBuffer.cs, and MinimalDistance.cs.
void ShapefileCategories.ApplyColorScheme2 ( tkColorSchemeType  Type,
ColorScheme  ColorScheme,
tkShapeElements  ShapeElement 
)

Applies color scheme to the visualization categories.

Parameters:
TypeThe method of interpolation.
ColorSchemeThe color scheme to take colors from.
ShapeElementThe element of the shape symbology to apply colors to.
void ShapefileCategories.ApplyColorScheme3 ( tkColorSchemeType  Type,
ColorScheme  ColorScheme,
tkShapeElements  ShapeElement,
int  CategoryStartIndex,
int  CategoryEndIndex 
)

Applies color scheme to the visualization categories.

Parameters:
TypeThe method of interpolation.
ColorSchemeThe color scheme to take colors from.
ShapeElementThe element of the shape symbology to apply colors to.
CategoryStartIndexThe index of the first category to apply colors to.
CategoryEndIndexThe index of the last category to apply colors to.
Examples:
AddCategoryRange.cs.
void ShapefileCategories.ApplyExpression ( int  CategoryIndex)

Maps particular shapes to the category based on ShapefileCategory.Expression.

The mapping between the category and shapes can be changed by Shapefile.set_ShapeCategory property.

Parameters:
CategoryIndexThe index of the category.

Maps shapes to the visualization categories based in ShapefileCategory.Expression.

The mapping between the category and shapes can be changed by Shapefile.set_ShapeCategory property.

Examples:
AddCategoryRange.cs, CreateBuffer.cs, MinimalDistance.cs, PointIcons.cs, and SplitByAttribute.cs.

Removes all the categories from the list.

void ShapefileCategories.Deserialize ( string  newVal)

Restores the state of the object from the string.

Parameters:
newValA string generated by ShapefileCategories.Serialize() method.
bool ShapefileCategories.Generate ( int  FieldIndex,
tkClassificationType  ClassificationType,
int  numClasses 
)

Generates visualization categories by certain attribute.

Parameters:
FieldIndexThe index of the field to generate categories by.
ClassificationTypeThe type of classification.
numClassesNumber of classes to generate. The parameter is omitted in case unique values classification is used.
Returns:
True on successful generation and false otherwise.
Examples:
CreateBuffer.cs, MinimalDistance.cs, and SplitByAttribute.cs.
bool ShapefileCategories.Generate2 ( string  FieldName,
tkClassificationType  ClassificationType,
int  numClasses 
)

Generates categories based on specified field.

Parameters:
FieldNameName of the field.
ClassificationTypeType of the classification.
numClassesThe number classes.
Returns:
True on success.
New API 4.9.4:
Added in version 4.9.4

Applies specific coloring to polygon layer based on 2 rules:

  • each polygon fill color must be different from the colors of all adjacent polygons;
  • the minimum overall number of colors must be used.
Parameters:
SchemeColor scheme to take colors from. If the number of color breaks is smaller than the number of polygon colors, interpolation with ColorScheme.GetGraduatedColor method will be used.

The coloring assumptions used by the method correspond to the formulation of Four color theorem. But simple greedy algorithm used by the method usually employs somewhat more colors (5-6), although provides much better performance than precise implementations.

Returns:
True on success.
New API 4.9.2:
Added in version 4.9.2

Gets index of the specified category within a collection.

Parameters:
CategoryCategory to find index for.
Returns:
Index of category.
New API 4.9.1:
Added in version 4.9.1
int ShapefileCategories.get_CategoryIndexByName ( string  categoryName)

Gets index of category by its name. The comparison is case-sensitive.

Parameters:
categoryNameCategory name to find index for.
Returns:
Index of category.
New API 4.9.1:
Added in version 4.9.1
string ShapefileCategories.get_ErrorMsg ( int  ErrorCode)

Gets the description of the specific error code.

Parameters:
ErrorCodeThe error code returned by ShapefileCategories.LastErrorCode
Returns:
The string with the description

Returns the category with the specified index.

Parameters:
IndexThe index of the category to retrieve.
Returns:
The reference to the category or NULL reference on failure.
ShapefileCategory ShapefileCategories.Insert ( int  Index,
string  Name 
)

Creates a new visualization category and inserts it at specified position of the list.

Parameters:
IndexThe index to insert category at.
NameThe name of the new category.
Returns:
Reference to the new category or NULL reference on failure.
bool ShapefileCategories.Insert2 ( int  Index,
ShapefileCategory  Category 
)

Inserts a category at the specified index in the collection.

Parameters:
IndexThe index.
CategoryThe category to be inserted.
Returns:
True on success.
New API 4.9.4:
Added in version 4.9.4
bool ShapefileCategories.MoveDown ( int  Index)

Moves the specified category down the list by swapping it with the succeeding category.

Parameters:
IndexThe index of the category to move down.
Returns:
True on success and false otherwise.
bool ShapefileCategories.MoveUp ( int  Index)

Moves the specified category up the list by swapping it with the preceding category.

Parameters:
IndexThe index of the category to move.
Returns:
True on success and false otherwise.
bool ShapefileCategories.Remove ( int  Index)

Removes the specified category.

Parameters:
IndexThe index of the category to remove.
Returns:
True on success and false otherwise.

Saves the state of the object to the string.

Returns:
A string with serialized state.
void ShapefileCategories.set_Item ( int  Index,
ShapefileCategory  pVal 
)

Replaces the category with the specified index with the new one.

Parameters:
IndexThe index of the category to replace.
pValThe new category.

Property Documentation

string ShapefileCategories.Caption [get, set]

The name of the classification scheme to display in the legend.

Gets or sets the index of classification that was used to generate categories.

New API 4.9.3:
Added in version 4.9.3

Returns the number of the categories in the list.

Examples:
SplitByAttribute.cs.

Gets or sets the callback object which is used to return to the client the information about progress and errors.

An instance of the class which implements ICallback interface should be passed. The class must be implemented by caller.

Deprecated:
v4.9.3 Use GlobalSettings.ApplicationCallback instead.
string ShapefileCategories.Key [get, set]

A text string associated with the instance of the class. Any value can be stored by developer in this property.

Retrieves the numeric code of the last error that took place in the class.

The usage of this property clears the error code.

A reference to the parent shapefile.

NULL reference will be returned in case the categories aren't associated with a shapefile.

 All Classes Files Functions Enumerations Properties Events