suture1.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# suture1.qry
# This is a sample script for drawing a double solid line with
# crossing lines to represent a collisional suture on a geotectonic
# map.  This effect is approximated by drawing a narrower white line
# over a wider colored line, then superimposing the crossing lines.  
# The space between the "two" apparent colored lines is white, not 
# transparent.
# Modified to provide scaling for LegendView samples, August 2002;
# Modified to declare all variables, October 2005;
# Version Dec. 2007
# Requires TNTmips 2007:73 or later.
# Modified to adjust scale based on georeference map units
numeric red, green, blue, scale;
numeric widthMap, width, spaceMap, spacing, overlay, length, half;
class RVC_GEOREFERENCE vGeoref;
class SR_COORDREFSYS vectCRS;
###################### Set Parameters ##############################
# red, green, blue variables define the color of the line
red = 255;			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 double line symbol
# WidthMap is the overall desired width in mm, assuming vector
# coordinates are in meters.
widthMap = 1.5;
# This variable controls the spacing betweeen the crossing
# lines.  SpaceMap is the desired map spacing in mm, assuming
# object coordinates are in meters.
spaceMap = 2;
# Check if vector has geographic coordinates (units of degrees instead of meters)
# and if so 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
	lineWidth = 0.5 * SampleRect.GetHeight();
	spacing = 0.3 * SampleRect.GetWidth();
	}
else {
	scale = scale / 1000;	# conversion from meters to millimeters at scale
	lineWidth = widthMap * scale;
	spacing = spaceMap * scale;
	}
overlay = lineWidth * 0.6;	# width of overlaid white line
length = 1.1 * overlay;
half = length * 0.5 ;
######################## Process ###########################
# Set line color and width for wide colored line and draw
LineStyleSetColor(red, green, blue);
LineStyleSetLineWidth(lineWidth);
LineStyleSetCapJoinType(1, 1);
LineStyleDrawLine();
# Set line color and width for narrower white line and draw
LineStyleSetColor(255, 255, 255);
LineStyleSetLineWidth(overlay);
LineStyleSetPosition(0); 			# return to start of line
LineStyleDrawLine();
# Mask ends of lines with white rectangles
LineStyleSetPosition(0);				# move to start of line
LineStyleMoveTo(0, 0);
LineStyleDrawRectangle(overlay, 1.1 * lineWidth, 0, 1);
LineStyleSetPosition(1);				# move to end of line
LineStyleMoveTo(0, 0);
LineStyleDrawRectangle(overlay, 1.1 * lineWidth, 0, 1);
# Set line color and width for crossing lines and draw
LineStyleSetPosition(0);				# move to start of line
LineStyleMoveTo(0, 0);
LineStyleSetColor(red, green, blue);
LineStyleSetLineWidth( (lineWidth - overlay) / 2);
while (LineStyleRoll(spacing) != 1) {
		LineStyleMoveTo(90, half);
		LineStyleLineTo(-90, length);
	}