anticlnAsym1.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# anticlnAsym1.qry
# This is a sample script for drawing the geological line symbol
# for an asymmetric anticline (solid, no arrow stems). Fold symbols
# are placed at the center of each line.  The steeper limb of the
# fold is assumed to be on the left side of the fold line; use the
# Spatial Editor to reverse line directions if necessary. 
# Version March 2008
# Requires TNTmips 2006:72 or later.
numeric red, green, blue, scale;
numeric widthMap, width, arrowSize, arrowLengthMap;
numeric halfSize, wingSize, angle, stemSize, dist;
class RVC_GEOREFERENCE vGeoref;
class SR_COORDREFSYS vectCRS;
class STRING coordUnit$;
###################### Set Parameters ##############################
# red, green, blue variables define the color of the line
red = 0;				green = 0;				blue = 0;
# This variable defines the denominator of the intended map scale.
# It is used as the basis for defining line width and symbol size
# and spacing.
# Example: for 1:24,000 map scale, Scale = 24000
scale = 24000;
# This variable controls the width of the lines.
# WidthMap is the desired map width in mm, assuming vector
# coordinates are in meters.
widthMap = 0.75;
# This variable controls the size of the arrows
# ArrowLengthMap is the desired arrowhead length in mm, assuming vector
# coordinates are in meters:
arrowLengthMap = 3;
# This variable controls the sweep angle of the arrow in degrees
angle = 80;			 # 80 degree angle
#######################  Compute Derived Values ########################
# Check if vector has geographic coordinates (units of degrees instead of meters)
# and if so automatically adjust scale factor to draw symbols of appropriate size.
Vect.GetDefaultGeoref(vGeoref);
vectCRS = vGeoref.GetCoordRefSys();
if (vectCRS.IsProjected() <> 1) {
	if (vectCRS.IsLocal() <> 1) {
		scale = scale * 0.000009;
		}
	}
else {	# CRS is projected; check coordinate units to adjust scale
	# get coordinate unit from the first axis of the planar coordinate system
	coordUnit$ = vectCRS.Coordsys.GetAxis(1).Unit.GetSymbol();
	scale = scale * GetUnitConvDist("m", coordUnit$);
	}
# set final dimensions for drawing
if (DrawingLegendView == 1) {	# set dimensions for LegendView based on sample size
	width = 0.1 * SampleRect.GetHeight();
	arrowSize = 0.4 * SampleRect.GetHeight();
	}
else {	# set dimensions for drawing elements in view
	scale = scale / 1000;	# conversion from meters to millimeters
	width = widthMap * scale;
	arrowSize = arrowLengthMap * scale;
	}
# This variable controls the length of the arrow head
wingSize = arrowSize / cosd(angle * 0.5);
######################### Draw #############################
# Set line color, width, and draw fold line.
LineStyleSetColor(red,green,blue);
LineStyleSetLineWidth(width);
LineStyleDrawLine();
# Draw arrow symbols
LineStyleSetPosition(0.5);			# position at midpoint of line
LineStyleSetLineWidth(0);
LineStyleDropAnchor(1);
LineStyleDrawArrow(90, arrowSize, wingSize, angle, 1);	# arrowhead on left
LineStyleMoveToAnchor(1);
LineStyleDrawArrow(-90, arrowSize, wingSize, angle, 1);	# arrowhead on right
LineStyleMoveToAnchor(1);
LineStyleMoveTo(90, arrowSize);
LineStyleDrawArrow(90, arrowSize, wingSize, angle, 1);	# draw extra arrowhead on left