dashDiQry.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# DashDiQry
# Line CartoScript illustrating dashed line
# with secondary symbol with different repeat interval.
# Draws dashed line with interspersed diamond symbols.
# Script from Using CartoScripts tutorial.
# Set line color and width
LineStyleSetColor(225,0,0);
LineStyleSetLineWidth(2);
# Set dash parameters 
dashSize = 12;   half = 0.5 * dashSize;
# Set diamond parameters
spacing = 5 * dashSize;
dodraw = 1;			dofill = 1;
width = 0.3 * dashSize;
cumL = 0;	# Cumulative length variable
# Draw line
while (LineStyleRoll(dashSize) <> 1) {
	cumL = cumL + dashSize;		# increment cumulative length
	if (cumL >= spacing) {	# draw diamond symbol
		LineStyleRoll(half);
		LineStyleMoveTo(0,0);
		LineStyleRecordPolygon(1);
		LineStyleSideshot(dodraw,0,half,90,width,180,half,-90,width);
		LineStyleDrawPolygon(dofill);
		LineStyleRoll(half);
		cumL = 0;					# reset cumulative length to 0
		}
	else {
		LineStyleRollPen(dashSize);	# draw dash
		cumL = cumL + dashSize;			# increment cumulative length
		}
	}