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.
How to use:
Platforms: WindowsRequires: 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
- In ArcMap, open a document and add any polygon shapefile or personal geodatabase with polygons.
- 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.
- 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'.
- Use the 'Unique values' renderer on the 'Symbology' tab of the layer properties dialogue box to display using the 'fourcolor' field.
||Class file that implements the COM Server.
||VB Form file for ForColorMap pop-up dialog.
||VB project file for sample.
||Compiled project DLL.
FeatureClass, FeatureCursor, QueryFilter, SpatialFilter, Feature, PointKey Interfaces:
IFeatureClass, IFeatureCursor, IQueryFilter, ISpatialFilter, IRelationalOperator, IProximityOperator, IFeature, IPointKey Members:
IFeatureClass::Search, IFeatureClass::Update, IFeatureCursor::UpdateFeature, ISpatialFilter::Geometry, ISpatialFilter::SpatialRel, ISpatialFilter::SpatialRelRelation, IQueryFilter::WhereClause
Send feedback on this sample