synclineQry.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# SynclineQry
# Line CartoScript to draw the geologic line
# style for a syncline.
# Script from Using CartoScripts tutorial.
# Read a logical database field (Yes/No) to check if syncline is 
# overturned.  Numeric variable is set to 1 if yes, 0 if no
overturned = Syncline.Overturned; 
# dimensions of arrow symbols
arrowSize = 30;		halfSize = arrowSize * 0.5;
headSize = 0.5 * arrowSize;	sweepAngle = 45;
stemSize = arrowSize - headSize * cosd(sweepAngle);
width = 2;	# width of lines
# Parameters for half circle in overturned syncline symbol
angle = 0;		shift = halfSize;		# angle and distance to center of arc
radius_x = halfSize;						# radii of arc
radius_y = halfSize;
startAngle = -180;		swpAngle = -180;
rotAngle = 0;				isAngleAbs = 0;
# Set line color, width, and draw fold line.
LineStyleSetColor(228,0,0);
LineStyleSetLineWidth(width);
LineStyleDrawLine();
# Draw arrow symbols in middle of each line
LineStyleSetPosition(0.5);		# move to middle of line
if ( overturned == 1 ) {		# draw overturned syncline symbol
	# Draw arrows with 0 line width
	LineStyleRoll(-halfSize);
	LineStyleDropAnchor(1);
	LineStyleSetLineWidth(0);
	LineStyleMoveTo(-90, arrowSize);
	LineStyleDropAnchor(2);
	LineStyleDrawArrow(90, arrowSize, headSize, sweepAngle, 1);
	LineStyleMoveTo(0, arrowSize);
	LineStyleMoveTo(-90, arrowSize);
	LineStyleDropAnchor(3);
	LineStyleDrawArrow(90, arrowSize, headSize, sweepAngle, 1);
	# Draw arrow stems and arc with linewidth = width
	LineStyleSetLineWidth(width);
	LineStyleMoveToAnchor(2);
	LineStyleLineTo(90, stemSize);
	LineStyleMoveToAnchor(1);
	LineStyleDrawArc(angle, shift, radius_x, radius_y, startAngle, swpAngle, isAngleAbs);
	LineStyleMoveToAnchor(3);
	LineStyleLineTo(90, stemSize);
	}
else {		# draw upright syncline symbol
	# Draw arrows with 0 line width
	LineStyleDropAnchor(1);
	LineStyleSetLineWidth(0);
	LineStyleMoveTo(90, arrowSize);
	LineStyleDropAnchor(2);
	LineStyleDrawArrow(-90, arrowSize, headSize, sweepAngle, 1);
	LineStyleMoveToAnchor(1);
	LineStyleMoveTo(-90, arrowSize);
	LineStyleDropAnchor(3);
	LineStyleDrawArrow(90, arrowSize, headSize, sweepAngle, 1);
	# Redraw arrow stems
	LineStyleMoveToAnchor(2);
	LineStyleSetLineWidth(width);
	LineStyleLineTo(-90, stemSize);
	LineStyleMoveToAnchor(3);
	LineStyleLineTo(90, stemSize);
	}