Four Color Map


Using this sample, you can automatically assign colors to polygons for a Four-Color map. It uses SpatialFilters, QueryFilters, RelationalOperators, and ProximityOperators to determine what color polygons can and should be colored. Options allowed to you set the amount of colors (four - nine) -- they appear in the 'fourcolor' 1 through n.

ArcEditor: VB6

Platforms: Windows

Requires: A shapefile or personal geodatabase containing polygons added to a map document. Must have required write access to change data schema and update records.

Minimum ArcGIS Release: 9.0

How to use:
  1. In ArcMap, open a document and add any polygon shapefile or personal geodatabase with polygons.
  2. Import this sample's .BAS file. To do this, open the Visual Basic Editor and in the Project Explorer, right-click on Project > Import File. In the dialog that comes up, select this sample's .BAS file.
  3. Open the .BAS file and run the FourColor_Click procedure. This will sort the polygons and then assign a value of one through four to a new field in its table called 'fourcolor'.
  4. Use the 'Unique values' renderer on the 'Symbology' tab of the layer properties dialogue box to display using the 'fourcolor' field.

File Description
FourColorMap.cls Class file that implements the COM Server.
FourColorMapDialog.frm VB Form file for ForColorMap pop-up dialog.
fourcolorDLL.vbp VB project file for sample.
fourcolorf.dll Compiled project DLL.

Key CoClasses:FeatureClass, FeatureCursor, QueryFilter, SpatialFilter, Feature, Point
Key Interfaces: IFeatureClass, IFeatureCursor, IQueryFilter, ISpatialFilter, IRelationalOperator, IProximityOperator, IFeature, IPoint
Key Members:IFeatureClass::Search, IFeatureClass::Update, IFeatureCursor::UpdateFeature, ISpatialFilter::Geometry, ISpatialFilter::SpatialRel, ISpatialFilter::SpatialRelRelation, IQueryFilter::WhereClause

Feedback Send feedback on this sample