Userdrawlayer – Pitney Bowes MapXtreme User Manual
Page 473

Appendix B: Customizing MapXtreme
Customizable Classes
MapXtreme v7.1
480
Developer Guide
{
public UsaPopulationDecreasedModifier() : base(null, null)
{
// use 2 columns for expressions
Expressions = new string[] { I18N.Wrap(
"Pop_1990",I18N.WrapType.Column),
I18N.Wrap("Pop_2000",I18N.WrapType.Column) };
}
// called during draw events
protected override System.Boolean
Modify(MapInfo.Styles.FeatureStyleStack styles,
object[] values)
{
// compares the values from each column
if ( double.Parse(values[0].ToString()) >
double.Parse(values[1].ToString()) )
{
// if population decreased, color the region red
CompositeStyle style = styles.Current;
if (style.AreaStyle.Interior is SimpleInterior)
{
((SimpleInterior)style.AreaStyle.Interior).ForeColor =
Color.Red;
// modifies the region
return true;
}
}
// does not modify the region
return false;
}
}
UserDrawLayer
The UserDrawLayer class is used to draw a custom layer in your map. You can populate this layer
with anything you like, including a customized logo, a transparent overlay of points, etc. To use this
class derive a new class from it and overload the draw method. The sample code below illustrates
this:
C# example:
using System.Runtime.Serialization;
using System;
using System.Drawing;
using MapInfo.Mapping;
[Serializable]
class MyUserDrawLayer : UserDrawLayer {
// Call the base class constructor with name and alias.