Making a cartographic line symbol
Cartographic line symbols allow you to create either solid, unbroken lines or lines that consist of a series of marks and gaps to create a variety of dashed symbols. The Cap property is used to control the appearance of start and end nodes. The Join property can control how line bends display.
The following code shows the creation of a dashed line symbol that consists of a long dash followed by three short dashes (dots):
[Java]
static void cartographicLineSymbol()throws Exception{
// Make a new Cartographic Line symbol and sets its properties
ICartographicLineSymbol cartographicLineSymbolCls = new CartographicLineSymbol();
// In order to set additional properties like offsets and dash patterns we must create an ILineProperties object
ILineProperties lineProperties = ((ILineProperties)(cartographicLineSymbolCls));
lineProperties.setOffset(0);
// Here's how to do a template for the pattern of marks and gaps
double pttrn[] = {
0, 7, 1, 1, 1, 0
};
ITemplate templateCls = new Template();
templateCls.setInterval(1);
// Add the mark/gap patterns into the Template
int jx = 0;
for (int ix = 1; ix <= 3; ix++){
templateCls.addPatternElement(pttrn[jx], pttrn[jx + 1]);
jx = jx + 2;
}
lineProperties.setTemplateByRef(templateCls);
//Set the cartographic line properties
cartographicLineSymbolCls.setWidth(2);
cartographicLineSymbolCls.setCap(esriLineCapStyle.esriLCSButt);
cartographicLineSymbolCls.setJoin(esriLineJoinStyle.esriLJSBevel);
// Make the line red
IRgbColor rgbColorCls = new RgbColor();
rgbColorCls.setRed(255);
rgbColorCls.setGreen(0);
rgbColorCls.setBlue(0);
cartographicLineSymbolCls.setColor(rgbColorCls);
}
See Also:
How to make a character marker symbolHow to make a gradient fill symbol
How to make a line callout
How to make a line fill symbol
How to make a picture marker symbol
How to make different types of colors
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |