# lftTransTen1c.qry # This is a sample script for drawing a solid line symbol for a # left-lateral transtensional fault. Tick marks are # drawn on the downthrown (left) side of the fault line. # If this is the wrong side for an individual line, use # the Spatial Data Editor to reverse its start and end points. # Strike-slip arrows are drawn centered between the pair of tick # marks that are closest to the line center. # Version March 2008 # Requires TNTmips 2006:72 or later. # Version 30 April 2008 # Improved drawing of displacement arrows so they look better for # wider line widths. Arrow offset determined from line width. # Special drawing instructions added for LegendView. numeric red, green, blue; numeric tickSizeMap, tickSize, tickSpaceMap, tickSpace, halfSpacing; numeric arrowLengthMap, arrowSize, wingSizeFac, wingSize, angle, offsetFac, arrowOffset; numeric arrowsDrawn; # flag to indicate whether arrow symbol has been drawn numeric lineCheck; 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 the width of the lines. # WidthMap is the desired map width in mm, assuming vector # coordinates are in meters. widthMap = 0.6; # This variable controls the length of the tick marks. # TickMap is the desired tick length in mm, assuming vector # coordinates are in meters: tickSizeMap = 2; # This variable controls spacing between tick marks. # SpaceMap is the desired spacing in mm, assuming vector # coordinates are in meters. It should be several times larger # than the arrowLengthMap set below. tickSpaceMap = 15; # This variable sets the length of the arrows # ArrowLengthMap is the desired arrow length in mm, assuming vector # coordinates are in meters: arrowLengthMap = 6; # This variable controls the sweep angle of the arrow in degrees angle = 30; # 30 degree angle # This variable sets the length of the side of the arrowhead as a # fraction of the arrow length wingSizeFac = 0.4; # This variable controls how far from the base line to draw arrows # as a multiple of line width offsetFac = 2.5; ####################### Compute Derived Values ######################## # 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 tickSize = 0.3 * SampleRect.GetHeight(); tickSpace = 0.45 * SampleRect.GetWidth(); width = 0.1 * SampleRect.GetHeight(); arrowSize = 0.35 * SampleRect.GetWidth(); } else { # set dimensions for drawing elements in View using scale scale = scale / 1000; # conversion from meters to millimeters tickSize = tickSizeMap * scale; tickSpace = tickSpaceMap * scale; width = widthMap * scale; arrowSize = arrowLengthMap * scale; } # Distance derived from spacing to use as origin for drawing displacement arrows halfSpacing = (tickSpace * 0.5) + (arrowSize * 0.5); # Compute final dimensions of the arrow head wingSize = wingSizeFac * arrowSize; headBase = wingSize * sind(angle); # length of base of half arrow head # Compute arrow offset from the base line arrowOffset = offsetFac * width; # get length of line in meters and set a check location 1 "spacing" distance # before the line center (length * 0.5) to trigger drawing displacement # arrows midway between adjacent triangles that are closest to the line center lineCheck = (LineStyleGetDistanceTo(3) * 0.5) - halfSpacing; ############################### Draw ########################### # Set line color and width and draw solid fault line LineStyleSetColor(red, green, blue); LineStyleSetLineWidth(width); LineStyleSetCapJoinType(0,0); LineStyleDrawLine(); # draw the solid line # initialize flag indicating if arrow symbols have been drawn yet arrowsDrawn = 0; # special drawing instructions for LegendView if (DrawingLegendView) { LineStyleRoll(tickSpace * 0.2); } else { LineStyleRoll(halfSpacing); # roll half space from start of line } # Draw first tick mark LineStyleMoveTo(0, 0); # set pen position at pointer on line LineStyleLineTo(90, tickSize); # draw first tick mark # Draw ticks at specified spacing along line while (LineStyleRoll(tickSpace) != 1) # while not at end of line, roll spacing distance { LineStyleMoveTo(0, 0); # set pen position at pointer on line LineStyleLineTo(90, tickSize); # draw first tick mark # draw displacement arrows when line position passes the check point # and set flag to indicate they have been drawn if (LineStyleGetPosition(1) > lineCheck && arrowsDrawn == 0) { LineStyleRoll(halfSpacing); # move pointer along line halfway to next tick mark; # pointer remains at this position while arrows are drawn # Draw first half-arrow backward on left side of line LineStyleMoveTo(90, arrowOffset); # move to base of arrow LineStyleDropAnchor(3); # anchor at base of arrow LineStyleMoveTo(180, arrowSize); # move to tip of arrow LineStyleDropAnchor(4); # anchor at tip of arrow LineStyleRecordPolygon(1); # start recording vertices for arrow head polygon LineStyleLineTo(angle, wingSize); # draw arrowhead side LineStyleLineTo(-90, headBase); # draw arrowhead base LineStyleDropAnchor(5); # anchor at base of arrow head on shaft LineStyleLineToAnchor(4); # move to anchor at tip of arrow LineStyleDrawPolygon(1); # fill polygon LineStyleMoveToAnchor(5); LineStyleLineToAnchor(3); # draw arrow shaft back to base LineStyleMoveToAnchor(4); # Draw other half-arrow forward on right side of line LineStyleMoveTo(-90, 2 * arrowOffset); # offset to other side of line LineStyleDropAnchor(6); # anchor at base of arrow LineStyleMoveTo(0, arrowSize); # move to tip of arrow LineStyleDropAnchor(7); # anchor at tip of arrow LineStyleRecordPolygon(1); # start recording vertices for arrow head polygon LineStyleLineTo(180 + angle, wingSize); LineStyleLineTo(90, headBase); LineStyleDropAnchor(8); LineStyleLineToAnchor(7); LineStyleDrawPolygon(1); # fill polygon LineStyleMoveToAnchor(8); LineStyleLineToAnchor(6); # draw arrow shaft back to base LineStyleRoll(-halfSpacing); # roll pointer back along line to end of previous # tick for next iteration to preserve spacing arrowsDrawn = 1; # set flag to indicate arrows have been drawn } }