Syntax Highlighing:
comments, key words, predefined symbols, class members & methods, functions & classes
# ArrowQry1
# Point CartoScript to draw a black arrow oriented in a
# direction determined from an azimuth value in the database.
# Script discussed in Using CartoScripts tutorial.
# Read azimuth from database table
azim = Direct.Azimuth;
# Convert azimuth to internal coordinate system
direction = -(azim - 90);
if (direction < 0) then direction = direction + 360;
# Set color values for symbol
red = 0; green = 0; blue = 0;
LineStyleSetColor(red, green,blue);
# Set dimensions for arrow
arrowLength = 30;
headSize = 0.4 * arrowLength;
sweepAngle = 40; dofill = 1;
# Draw arrow with zero line width, tip of stem at point
LineStyleDropAnchor(0); # anchor at point
LineStyleSetLineWidth(0);
LineStyleDrawArrow(direction,arrowLength,headSize,sweepAngle,dofill);
LineStyleDropAnchor(1); # anchor at tip of arrow
# Redraw arrow stem with wider line
stemLength = arrowLength - headSize * cosd(sweepAngle);
LineStyleMoveToAnchor(0);
LineStyleSetLineWidth(1);
LineStyleLineTo(direction, stemLength);
LineStyleMoveToAnchor(1); # pen to arrow tip in prep for label