Class GradientStyle
This gradient style is a new style with the concept of GradientBrush. By specifying the LowerValue and its color, as well as the UpperValue and its color, we can set the color of each feature based on a column value using linear interpolation.
public class GradientStyle : Style
- Inheritance
-
GradientStyle
- Inherited Members
Constructors
GradientStyle(string, double, GeoColor, double, GeoColor)
This constructor creates a new instance by passing the ColumnName (which it will get the data from) as well as the lowerValue and its corresponding SolidBrush, and the upperValue and its corresponding SolidBrush.
public GradientStyle(string columnName, double lowerValue, GeoColor lowerColor, double upperValue, GeoColor upperColor)
Parameters
Remarks
In this constructor, the NoDataValue defaults to -9999 and the NoDataBrush color is transparent.
GradientStyle(string, double, GeoColor, double, GeoColor, double, GeoColor)
This constructor creates a new instance by passing the ColumnName (which it will get the data from) as well as the lowerValue and its corresponding SolidBrush, the upperValue and its corresponding SolidBrush, and the NoDataValue and its corresponding SolidBrush.
public GradientStyle(string columnName, double lowerValue, GeoColor lowerColor, double upperValue, GeoColor upperColor, double noDataValue, GeoColor noDataColor)
Parameters
columnName
stringlowerValue
doublelowerColor
GeoColorupperValue
doubleupperColor
GeoColornoDataValue
doublenoDataColor
GeoColor
Properties
ColumnName
This property gets and sets the column name used in the style.
public string ColumnName { get; set; }
Property Value
- string
This property gets and sets the column name used in the style.
Remarks
None.
LowerColor
This property gets and sets the solid brush that is used for the style's lower value.
public GeoColor LowerColor { get; set; }
Property Value
- GeoColor
This property gets and sets the solid brush that is used for the style's lower value.
Remarks
None.
LowerValue
This property gets and sets the lower value used in the style.
public double LowerValue { get; set; }
Property Value
- double
This property gets and sets the lower value used in the style.
Remarks
None.
NoDataColor
This property gets and sets the solid brush that is used for the style's NoDataValue.
public GeoColor NoDataColor { get; set; }
Property Value
- GeoColor
This property gets and sets the solid brush that is used for the style's NoDataValue.
Remarks
None.
NoDataValue
This property gets and sets the no data value used in the style.
public double NoDataValue { get; set; }
Property Value
- double
This property gets and sets the no data value used in the style.
Remarks
None.
UpperColor
This property gets and sets the solid brush that is used for the style's upper value.
public GeoColor UpperColor { get; set; }
Property Value
- GeoColor
This property gets and sets the solid brush that is used for the style's upper value.
Remarks
None.
UpperValue
This property gets and sets the upper value used in the style.
public double UpperValue { get; set; }
Property Value
- double
This property gets and sets the upper value used in the style.
Remarks
None.
Methods
DrawCore(IEnumerable<Feature>, GeoCanvas, Collection<SimpleCandidate>, Collection<SimpleCandidate>)
This method draws the features on the view you provided.
protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)
Parameters
features
IEnumerable<Feature>This parameter represents the features you want to draw on the view.
canvas
GeoCanvasThis parameter represents the view you want to draw the features on.
labelsInThisLayer
Collection<SimpleCandidate>The labels will be drawn in the current layer only.
labelsInAllLayers
Collection<SimpleCandidate>The labels will be drawn in all layers.
Remarks
This virtual method is called from the concrete public method Draw. In this
method, we take the features you passed in and draw them on the view you provided.
Each style (based on its properties) may draw each feature differently.
When implementing this virtual method, consider each feature and its column data
values. You can use the full power of the GeoCanvas to do the drawing. If you need
column data for a feature, be sure to override the GetRequiredColumnNamesCore and add
the columns you need to the collection. In many of the styles, we add properties to
allow the user to specify which field they need; then, in the GetRequiredColumnNamesCore,
we read that property and add it to the collection.
GetRequiredColumnNamesCore()
This method returns the column data for each feature that is required for the style to properly draw.
protected override Collection<string> GetRequiredColumnNamesCore()
Returns
- Collection<string>
This method returns a collection of column names that the style needs.
Remarks
This abstract method is called from the concrete public method
GetRequiredFieldNames. In this method, we return the column names that are required for
the style to draw the feature properly. For example, if you have a style that colors
areas blue when a certain column value is over 100, then you need to be sure you include
that column name. This will ensure that the column data is returned to you in the
feature when it is ready to draw.
In many of the styles, we add properties to allow the user to specify which field they
need; then, in the GetRequiredColumnNamesCore we read that property and add it to the
collection.