normflt1.qry

  Download

More scripts: Style By Script

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# normflt1.qry
# This is a sample script for drawing a geological
# normal fault (solid).  Tick marks indicating downthrown side of
# fault are drawn on the left side of the line.
# If this is the wrong side for an individual line,
# use the Spatial Data Editor to reverse its start and end points.
# 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 spaceMap, spacing, halfSpace, dist;
numeric widthMap, width, tickMap, tickSize;
class RVC_GEOREFERENCE vGeoref;
class SR_COORDREFSYS vectCRS;
class STRING coordUnit$;
###################### 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 spacing between tick marks.
# SpaceMap is the desired spacing in mm, assuming vector
# coordinates are in meters:
spaceMap = 4;
# This variable controls the length of the tick marks.
# TickMap is the desired tick length in mm, assuming vector
# coordinates are in meters:
tickMap = 1.5 ;
# These variables control the width of the line and tick marks.
# WidthMap is the desired map width in mm, assuming vector
# coordinates are in meters.
widthMap = 0.3;
# 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 		
	spacing = 0.3 * SampleRect.GetWidth();
	tickSize = 0.3 * SampleRect.GetHeight();
	width = 0.1 * SampleRect.GetHeight();
	}
else {			# set dimensions for drawing elements in view
	scale = scale / 1000;	# conversion from meters to millimeters
	spacing = spaceMap * scale;
	tickSize = tickMap * scale;
	width = widthMap * scale;
	}
halfSpace = spacing * 0.5;
######################## Process ###########################
# Set line color, width, and draw line
LineStyleSetColor(red,green,blue);
LineStyleSetLineWidth(width);
LineStyleDrawLine();				# draw solid line
# Draw tick marks
LineStyleRoll(halfSpace);	# roll half space from start of line
LineStyleMoveTo(0, 0);				# initialize pen position on line
LineStyleLineTo(90, tickSize);	# draw first tick mark
while (LineStyleRoll(spacing) != 1) {	# while not at end of line roll one space
	dist = LineStyleGetDistanceTo(3);	# check distance to end of line
	if (dist > halfSpace) {
		LineStyleMoveTo(0, 0);				# reinitialize pen position on line
		LineStyleLineTo(90, tickSize);	# draw tick mark
		}
	}