t e m p o r a l 
 d o o r w a y 

Setting Feature Appearance in MapX

 

The MapX documentation does not make it fully clear how to set the characteristics of features. Particularly confusing are those routines which require a "Currency" value as the parameter - this is a really a 64 bit integer (a long long), but that is not documented anywhere I looked (except in a careful reading of header files).

Here's an example of getting and setting most of the major characteristics of a Layer.

CMapXLayer Layer = LayerByName(theLayerName);
CMapXStyle RequiredStyle = Layer.GetStyle().Clone();

RequiredStyle.SetSymbolCharacter((short) theSymbolCharacter);
RequiredStyle.SetSymbolFontColor(theSymbolCharacterColor);
RequiredStyle.SetSymbolFontShadow(theSymbolHasADropShadow);
RequiredStyle.SetSymbolFontHalo(theSymbolHasAHalo);

if (theSymbolHasAHalo) RequiredStyle.SetSymbolFontBackColor(miColorBlack);

COleFont SymbolFont = RequiredStyle.GetSymbolFont();

SymbolFont.SetName("Map Symbols");

CY CYSize;
CYSize.int64 = ((LONGLONG) theSymbolSize)*10000;

SymbolFont.SetSize(CYSize);

Layer.SetStyle(RequiredStyle);
Layer.SetAutoLabel(TRUE);

if (theMinZoomVisible > 0 || theMaxZoomVisible > 0)
{
   Layer.SetZoomMax(theMaxZoomVisible);
   Layer.SetZoomMin(theMinZoomVisible);
   Layer.SetZoomLayer(TRUE);
};

Layer.GetLabelProperties().SetVisible(TRUE);

COleFont LabelFont = Layer.GetLabelProperties().GetStyle().GetTextFont();

LabelFont.SetName(theLabelFontName);
LabelFont.SetBold(theLabelIsBold);

CYSize.int64 = ((LONGLONG) theLabelSize)*10000;

LabelFont.SetSize(CYSize);
Layer.GetLabelProperties().GetStyle().SetTextFontColor(theLabelColor);

Layer.SetOverrideStyle(TRUE);

return TRUE;

The next example changes a feature. It assumes you have already obtained the feature. Note how similar it is to setting the characteristics for all of the features in the layer - the major difference is that a layer has label characteristics to set.

CMapXStyle RequiredStyle = Feature.GetStyle().Clone();

RequiredStyle.SetSymbolCharacter((short) theSymbolCharacter);
RequiredStyle.SetSymbolFontColor(theSymbolCharacterColor);
RequiredStyle.SetSymbolFontShadow(theSymbolHasADropShadow);
RequiredStyle.SetSymbolFontHalo(theSymbolHasAHalo);

if (theSymbolHasAHalo) RequiredStyle.SetSymbolFontBackColor(miColorBlack);

COleFont SymbolFont = RequiredStyle.GetSymbolFont();

SymbolFont.SetName("Map Symbols");

CY CYSize;
CYSize.int64 = ((LONGLONG) theSymbolSize)*10000;

SymbolFont.SetSize(CYSize);

Feature.SetStyle(RequiredStyle);

Feature.GetLabelProperties().SetVisible(TRUE);

COleFont LabelFont = Feature.GetLabelProperties().GetStyle().GetTextFont();

LabelFont.SetName(theLabelFontName);
LabelFont.SetBold(theLabelIsBold);

CYSize.int64 = ((LONGLONG) theLabelSize)*10000;

LabelFont.SetSize(CYSize);
Feature.GetLabelProperties().GetStyle().SetTextFontColor(theLabelColor);

Feature.SetOverrideStyle(TRUE);

Copyright © 2004 by Mark Cashman (unless otherwise indicated), All Rights Reserved