# beddingStrikeDip.qry # This is a sample script for drawing geologic point # symbols for strike and dip of bedding, including # special cases of horizontal, vertical, overturned bedding. # The dip value is shown as a text label, except in the # cases of horizontal and vertical bedding. # Information required for each point includes the strike # value (degrees), dip value (degrees), and whether the bed is # overturned. Each of these values is read from a particular # field in an attached database table. To use the script you # will need to edit the statements that include database references # to conform to your table name and field names. # Strike angle must be specified as azimuth (0 to 360 degrees # clockwise from north). Dip direction is defined by the # strike azimuth using the right hand rule: of the two possible # azimuths for a given strike line, choose the azimuth the # strike line points toward with the dip direction on the right hand # side of the strike line. (For overturned beds, substitute facing # direction [stratigraphic top] for dip direction in the rule). # The script assumes that the database field for overturned # bedding is a Logical field, with Yes indicating overturned bed # and No (default value) indicating upright bedding. # Modified for Legend samples August 2002. # Modified to declare all variables October 2005; # Modified to correct for angle between grid north and true north May 2006. # Version Nov. 2007 # Requires TNTmips 2007:73 or later # Modified to adjust scale based on georeference map units. numeric azStrike, dip1, overturned1, red, green, blue; numeric scale, strikeLengthMap, lineWidthMap, strikeLength, lineWidth; numeric halfLength, tickLength, doubTick, halfTick, heightMap, height, offset; string fontName$, label$; numeric direction, oppStrike, dipDir, oppDip; numeric next_x ,next_y, labelLength, shift1, shift2; numeric northAng; class POINT2D point; string coordUnit$; ###################### Set Parameters ############################## # Read strike azimuth and dip value from table.field azStrike = Bedding.StrikeAngle #### change to fit your data #### dip1 = Bedding.DipAngle; #### change to fit your data #### # This variable defines the denominator of the intended map scale. # It is used as the basis for defining line width and symbol size. # Example: for 1:24,000 map scale, Scale = 24000 scale = CurrentMapScale * 1.8; # Check if vector has geographic coordinates (units of degrees instead of meters) # and if so adjust scale factor to draw symbols of appropriate size. class RVC_GEOREFERENCE vGeoref; class SR_COORDREFSYS vectCRS; Vect.GetDefaultGeoref(vGeoref); vectCRS = vGeoref.GetCoordRefSys(); if (vectCRS.IsProjected() <> 1) { if (vectCRS.IsLocal() <> 1) { scale = scale * 0.00001; } } 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$); } # find angle to north at the current point's map coordinates class TRANS2D_MAPGEN transObjToMap; class TRANSMODEL model; model = vGeoref.GetCalibModel(); vGeoref.GetTransParm(transObjToMap, 0, model); point.x = Vect.Point.Internal.x; # object coordinates of current point point.y = Vect.Point.Internal.y; point = transObjToMap.ConvertPoint2DFwd(point); # convert to map coordinates northAng = vectCRS.ComputeAngleToNorth(point); # subtract angle to north from stored strike value for display azStrike = azStrike - northAng; # red, green, blue variables define the color of the symbols and label red = 0; green = 0; blue = 0; # These variables define the dimensions and line widths of the # symbol. StrikeLengthMap is the desired length of the symbol # strike line in mm, assuming vector coordinates are in meters. # LineWidthMap is the desired line width in mm. strikeLengthMap = 6; lineWidthMap = 0.3; if (DrawingLegendView == 1) { strikeLength = 0.5 * SampleRect.GetWidth(); lineWidth = 0.08 * strikeLength; } else { strikeLength = strikeLengthMap * scale / 1000; lineWidth = lineWidthMap * scale / 1000; } halfLength = 0.5 * strikeLength; tickLength = halfLength * 0.5; halfTick = tickLength * 0.5; doubTick = tickLength * 2; # These variables control the drawing of the label text string. # HeightMap is the desired height of the letters in mm, # assuming vector coordinates are in meters. heightMap = 2.5; height = heightMap * scale / 1000; fontName$ = "ARIALBD.TTF"; offset = 0.5 * tickLength; # offset of label from symbol ######################### Process ############################ # Convert strike azimuth to internal coordinate system. direction = -(azStrike - 90); if (direction < 0) direction = direction + 360; oppStrike = direction -180; dipDir = direction - 90; oppDip = dipDir - 180; # Convert dip value to a string and assign it # to a string variable for use as label label$ = sprintf("%2d", dip1); # Find length of label text for label positioning LineStyleTextNextPosition(label$, height, 0, 1, next_x ,next_y, labelLength); # Set line color, width, and end type LineStyleSetColor(red, green, blue); # set symbol color LineStyleSetLineWidth(lineWidth); LineStyleSetCapJoinType(1,1); # square ends of lines ########### Draw symbol # Special symbol for horizontal bedding (cross in circle) if (dip1 == 0){ LineStyleDropAnchor(0); LineStyleDrawCircle(halfLength); LineStyleMoveTo(90, halfLength); LineStyleLineTo(-90, strikeLength); LineStyleMoveToAnchor(0); LineStyleMoveTo(0, halfLength); LineStyleLineTo(180, strikeLength); } else { # For nonzero dip, draw strike line with center at point LineStyleDropAnchor(0); LineStyleMoveTo(direction, halfLength); LineStyleLineTo(oppStrike, strikeLength); LineStyleMoveToAnchor(0); # Draw appropriate symbol for dip direction if (dip1 == 90) { # crossbar for vertical bed LineStyleMoveTo(dipDir, tickLength); LineStyleLineTo(oppDip, doubTick); } else { if (Bedding.Overturned) { # dip symbol for overturned beds LineStyleDrawArc(0, 0, halfTick, halfTick, direction, -180, 0); LineStyleMoveTo(direction, halfTick); LineStyleLineTo(oppDip, doubTick); } else { # dip direction tick mark LineStyleLineTo(dipDir, tickLength); } } } ########## Add dip label if bedding is not horizontal or vertical if (dip1 > 0 and dip1 < 90) { # Set font name and text color LineStyleSetFont(fontName$); LineStyleSetTextColor(red, green, blue); # Compute label shift parallel to strike to center label shift1 = 0.5 * ( labelLength * cosd(direction) + height * sind(direction) ); if (shift1 <0) { shift1 = abs(shift1); LineStyleMoveTo(direction, shift1); } else { LineStyleMoveTo(oppStrike, shift1); } # Compute label shift in dip direction to avoid overwriting symbol if (Bedding.Overturned) { if (direction >= 0 and direction < 90) shift2 = offset + 0.8 * labelLength * cosd(dipDir); if (direction >= 90 and direction < 180) shift2 = offset + 0.8 * (labelLength * cosd(dipDir) + height * sind(dipDir)); if (direction >= 180 and direction < 270) shift2 = offset + 0.8 * height * sind(dipDir); if (direction >= 270 and direction <= 360) shift2 = offset; LineStyleMoveTo(direction + 90, shift2); LineStyleDrawText(label$, height, 0, 1); } else { # place label for upright bedding if (direction >= 0 and direction< 90) shift2 = offset - 0.8 * height * sind(dipDir); if (direction >= 90 and direction < 180) shift2 = offset; if (direction >= 180 and direction < 270) shift2 = offset - 0.8 * labelLength * cosd(dipDir); if (direction >= 270 and direction <= 360) shift2 = offset - 0.8 * ((labelLength * cosd(dipDir)) + (height * sind(dipDir))); LineStyleMoveTo(dipDir, shift2); LineStyleDrawText(label$, height, 0, 1); } }