#---------------------- # neatline.sml # sample script for SML display layer # draws border, color tic marks and title # use with LITEDATA / CB_DATA / CB_COMP / _8_BIT # other drawing toys are at the end of the script # Keith Ghormley, MicroImages, Inc. 1998, 1999 # -------------------- #fill interior with solid white #DrawSetFillStyle("BnD") #FillRegion(ThisLayer.group.FullRegion) #Get Georef coordinate extents class COLOR red; red.name = "red"; class COLOR blue; blue.name = "blue"; class COLOR gray0; gray0.name = "gray0"; class RECT rect; rect = ThisLayer.Extents; xrange = abs(rect.x2 - rect.x1); yrange = abs(rect.y2 - rect.y1); LineStyleSetRegion(ThisLayer.group.FullRegion); #------------- # Draw a box #__________________________ offset = 1000; DrawTextSetColors(blue,blue); SetLineWidth(4); MoveTo((rect.x1+rect.x2)/2-4000,rect.y1-3*offset); DrawTextSetHeightPixels(26); DrawTextSimple("Crow Butte SML Layer"); SetColorName("gray0"); SetLineWidth(2); MoveTo(rect.x1-offset,rect.y1-offset); DrawTo(rect.x1-offset,rect.y2+offset); DrawTo(rect.x2+offset,rect.y2+offset); DrawTo(rect.x2+offset,rect.y1-offset); DrawTo(rect.x1-offset,rect.y1-offset); #------------- # edge tic marks #------------- SetColorName("red"); inc = 1000; length = xrange / 50; DrawTextSetColors(gray0,blue); # West edge i=0; loc=0; While (loc < rect.y2) { i = i+1; SetColorName("red"); MoveTo(rect.x1-offset,rect.y1-offset+(i*inc)); DrawTo(rect.x1-offset-length,rect.y1-offset+(i*inc)); loc = rect.y1+i*inc; MoveTo(rect.x1-2.5*offset,rect.y1-offset+(i*inc)); DrawTextSetHeightPixels(8); DrawTextSimple(sprintf("%3d",loc)); } # South edge i=0; loc=0; SetColorName("red"); While (loc < rect.x2) { i = i+1; SetColorName("red"); MoveTo(rect.x1-offset+(i*inc),rect.y1-offset); DrawTo(rect.x1-offset+(i*inc),rect.y1-offset-length); loc = rect.x1+i*inc; MoveTo(rect.x1-offset+(i*inc),rect.y1-offset-3*length); DrawTextSetHeightPixels(8); DrawTextSimple(sprintf("%3d",loc)); } # East edge i=0; loc=0; While (loc < rect.y2) { i = i+1; MoveTo(rect.x2+offset,rect.y1-offset+(i*inc)); DrawTo(rect.x2+offset+length,rect.y1-offset+(i*inc)); loc = rect.y1+i*inc; } # North edge i=0; loc=0; While (loc < rect.x2) { i = i+1; MoveTo(rect.x1-offset+(i*inc),rect.y2+offset); DrawTo(rect.x1-offset+(i*inc),rect.y2+offset+length); loc=rect.x1+i*inc; } #------------------ # interior tic marks #-------------------- length = 100; # red background tic SetColorName("red"); SetLineWidth(3); y = rect.y1+inc; While (y < rect.y2) { x = rect.x1+inc; While (x < rect.x2) { MoveTo(x,y); DrawTo(x-length,y); MoveTo(x,y); DrawTo(x+length,y); MoveTo(x,y); DrawTo(x,y+length); MoveTo(x,y); DrawTo(x,y-length); x = x + inc; } y = y + inc; } # black overstrike tic SetLineWidth(1);SetColorName("black"); y = rect.y1+inc; While (y < rect.y2) { x = rect.x1+inc; While (x < rect.x2) { MoveTo(x,y); DrawTo(x-length,y) MoveTo(x,y); DrawTo(x+length,y) MoveTo(x,y); DrawTo(x,y+length) MoveTo(x,y); DrawTo(x,y-length) x = x + inc; } y = y + inc; } #---------- # Cartoscript star engine: # set factor to change number of points # 240 for 3, 270 for 4, 216 for 5, 225 for 8, 200 or 280 for 9, 210 for 12, ... #--------- #LineStyleMoveTo(55,xrange) #factor = 206 #i=1 #SetLineWidth(3) #While (i < 129) { # LineStyleSetColor(i,3*i,0) # LineStyleLineTo(factor*i,xrange/2) # i=i+1 #} #--------------------------- # draw spirograph(r) thing #--------------------------- #SetLineWidth(2) #LineStyleSetColor(0,110,255) #i = 0 #inc = 11 #angle = 45 #size = 1700 #While (i < 361) { # LineStyleMoveTo(7*angle+i,size) # LineStyleLineTo(5*angle+i,size) # LineStyleLineTo(3*angle+i,size) # LineStyleMoveTo(angle+i,size) # i = i + inc #} #-------- # draw box # ---------- #period = 25; size=8; filled=1 While (LineStyleRoll(period)!=1) { LineStyleRollPen(period); } #Draw edge1 #SetLineWidth(5) #LineStyleSetColor(0,0,255) #LineStyleDrawLine() #Draw edge2 #LineStyleSetColor(255,255,255) #SetLineWidth(1) #LineStyleDrawLine() #------------------------ #fancy border scallops #------------------------ #LineStyleSetRegion(ThisLayer.group.FullRegion) #inc = 200 #r = 0.75 * inc #SetColorName("red") #while(LineStyleRoll(inc) != 1) { # LineStyleDrawArc(0,0,r,r,180,180,0,0,0,0) # } #LineStyleSetRegion(ThisLayer.group.FullRegion) #inc = inc * 2 #r = r * 2 #SetColorName("blue") #while(LineStyleRoll(inc) != 1) { # LineStyleDrawArc(0,0,r,r,180,180,0,0,0,0) # }