Document Viewer

« Back

3. Hands-On: GraphRep Class "X" - RESIZE

GRAPHREP Preparation for Class "X"

GRAPHREP Implementation for Class  "X"

  • Since this class is concrete, a graphical representation needs to be defined.
  • Use inherited class attribute "GraphRep" to define the graphical representation
  • Write GRAPHREP code to provide a notation for the class

Commented GraphRep Code: "X"

#Allow Resizing
GRAPHREP sizing: asymmetrical
PEN style:dash
#handling of programmcall attribute - cut out the filename
AVAL set-default: "" a: "External graphic"
SET e: (LEN a)
SET s: (search(a,"@",0) + 1)
SET grfk: (copy(a, s, e - s))
SET e: ((LEN grfk))
SET s: (bsearch( grfk, ".", e-1) )
SET ext: (copy (grfk, s, e-s-1))
SET ext: (lower(ext))
TABLE w: 5cm h: 5cm cols: 1 rows: 1
STRETCH off
RECTANGLE w: (tabw1) h: (tabh1)
#Image Handling
IF ( (ext=".bmp") OR (ext=".gif") OR (ext=".ico") OR (ext=".jpg")
OR (ext=".jpeg") OR (ext=".png") OR (ext=".targa") OR (ext=".tiff")
OR (ext=".wbmp") OR (ext=".xpm") )
BITMAP (copy(grfk,1,e-2)) w:(tabw1) h:(tabh1)
ENDIF