dashThrustQry.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# DashThrustQry
# Line CartoScript illustrating dashed line
# with secondary symbol with different repeat interval.
# Draws dashed line with triangle symbols
# (geologic line style for thrust fault).
# Script from Using CartoScripts tutorial.
dashSize = 16;						# length of dashes
halfDash = dashSize * 0.5;
# triangle spacing and dimensions
spacing = dashSize * 6;
quartSpace = spacing * 0.25;
triWidth = dashSize;
halfTri = triWidth * 0.5;
height = dashSize * 0.6;
# Set line color and width
LineStyleSetColor(255,0,0);
LineStyleSetLineWidth(2);
# Initialize variable to control placement of triangles
cumL = spacing;
# Draw dashed fault line and triangles
while (LineStyleRoll(halfDash) <> 1) {
	dist = LineStyleGetDistanceTo(3);		# distance to end of line
	cumL = cumL + dashSize;
	if (dist > quartSpace and cumL >= spacing) {
		LineStyleDropAnchor(1);
		LineStyleRoll(halfTri);
		LineStyleMoveTo(0,0);
		LineStyleMoveTo(90, height);
		LineStyleDropAnchor(2);
		LineStyleRoll(-halfTri);
		LineStyleRecordPolygon();
		LineStyleRollPen(triWidth);
		LineStyleLineToAnchor(2);
		LineStyleLineToAnchor(1);
		LineStyleDrawPolygon(1);
		cumL = 0;
		}
	else {
		LineStyleRollPen(dashSize);
		cumL = cumL + dashSize;
		}
	}