mglib

Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes

vis/objectgraphics/

mggrsvg__define.pro

includes main-level program

Object graphics destination for producing Scalable Vector Graphics (SVG) files.

Because SVG is inherently 2-dimensional, it only supports 2-dimensional object graphics hierarchies. Only objects of the following classes are supported:

IDLgrScene svg element IDLgrViewGroup svg element IDLgrView svg element IDLgrModel g element IDLgrText (and IDLgrFont) text element IDLgrPolygon (and IDLgrPattern) path element (TODO: handle patterns) IDLgrPolyline (and IDLgrSymbol) path element (TODO: handle symbols) IDLgrPlot path element IDLgrAxis IDLgrImage image element

Examples

Run the main-level program at the end of this file to see an example:

IDL> .run mggrsvg__define
This should produce the following:

Class description for mggrsvg

Properties

Properties in mggrsvg

_extra init
cm set
dimension_units get
dimensions get set

dimensions of the drawing canvas in units specified by the EM, EX, PX, PT, PC, CM, MM, INCHES, PERCENTAGE property at the same time as the DIMENSIONS property is set; if no dimensions are specified, the canvas is scaled to fill the available area

em set
ex set
filename get set

filename of file to write to

graphics_tree get set

default picture to draw

inches set
mm set
pc set
percentage set
pt set
px set
text_multipler get

Routines

Routines from mggrsvg__define.pro

result = mggrsvg::_getRgb(color)

Return a valid SVG specification for a color.

result = mggrsvg::_getVpr(tree, dimensions=dimensions, dimension_units=dimension_units)

Returns the VIEWPLANE_RECT for the view that contains the item.

result = mggrsvg::_convertUnits(x, xUnits, outUnits)
result = mggrsvg::_transformCoords(data, tree=tree)
mggrsvg::_handleScene, scene, lun=long, indent=string

Handle IDLgrScene objects.

mggrsvg::_handleViewgroup, viewgroup, lun=long, indent=string

Handle IDLgrViewGroup objects.

mggrsvg::_handleView, view, lun=long, indent=string

Handle IDLgrView objects.

mggrsvg::_handleModel, model, lun=long, indent=string

Handle IDLgrModel objects.

mggrsvg::_handlePolyline, polyline, lun=long, indent=string

Handle IDLgrPolyline objects.

mggrsvg::_handlePolygon, polygon, lun=long, indent=string

Handle IDLgrPolygon objects.

mggrsvg::_handleText, text, lun=long, indent=string

Handle IDLgrText objects.

mggrsvg::_handleImage, image, lun=long, indent=string

Handle IDLgrImage objects.

mggrsvg::_handlePlot, plot, lun=long, indent=string

Handle IDLgrPlot objects.

mggrsvg::_handleAxis, axis, lun=long, indent=string

Handle IDLgrAxis objects.

mggrsvg::_traverse, tree, lun=long, indent=string

Routine which is recursively called to traverse the object graphics hierarchy.

mggrsvg::draw [, tree]

Write the object graphics rooted at the specified scene or view.

mggrsvg::setProperty, filename=filename, graphics_tree=graphics_tree, dimensions=dimensions, em=em, ex=ex, px=px, pt=pt, pc=pc, cm=cm, mm=mm, inches=inches, percentage=percentage

Set properties.

mggrsvg::getProperty, filename=filename, graphics_tree=graphics_tree, text_multipler=text_multipler, dimensions=dimensions, dimension_units=dimension_units

Get properties.

mggrsvg::cleanup

Free resources.

result = mggrsvg::init( [_extra=keywords])

Create an SVG destination.

mggrsvg__define

Define instance variables.

Routine details

top mggrsvg::_getRgb

result = mggrsvg::_getRgb(color)

Return a valid SVG specification for a color.

Return value

string

Parameters

color in required type=bytarr(3)

color to convert

top mggrsvg::_getVpr

result = mggrsvg::_getVpr(tree, dimensions=dimensions, dimension_units=dimension_units)

Returns the VIEWPLANE_RECT for the view that contains the item.

Return value

fltarr(4) or -1L

Parameters

tree in required type=object

object in the object graphics hierarchy

Keywords

dimensions
dimension_units

top mggrsvg::_convertUnits

result = mggrsvg::_convertUnits(x, xUnits, outUnits)

Parameters

x
xUnits
outUnits

top mggrsvg::_transformCoords

result = mggrsvg::_transformCoords(data, tree=tree)

Parameters

data

Keywords

tree

top mggrsvg::_handleScene

mggrsvg::_handleScene, scene, lun=long, indent=string

Handle IDLgrScene objects.

Parameters

scene in required type=object

IDLgrScene object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleViewgroup

mggrsvg::_handleViewgroup, viewgroup, lun=long, indent=string

Handle IDLgrViewGroup objects.

Parameters

viewgroup in required type=object

IDLgrViewGroup object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleView

mggrsvg::_handleView, view, lun=long, indent=string

Handle IDLgrView objects.

Parameters

view in required type=object

IDLgrView object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleModel

mggrsvg::_handleModel, model, lun=long, indent=string

Handle IDLgrModel objects.

Parameters

model in required type=object

IDLgrModel object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handlePolyline

mggrsvg::_handlePolyline, polyline, lun=long, indent=string

Handle IDLgrPolyline objects.

Parameters

polyline in required type=object

IDLgrPolyline object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handlePolygon

mggrsvg::_handlePolygon, polygon, lun=long, indent=string

Handle IDLgrPolygon objects.

Parameters

polygon in required type=object

IDLgrPolygon object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleText

mggrsvg::_handleText, text, lun=long, indent=string

Handle IDLgrText objects.

Parameters

text in required type=object

IDLgrText object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleImage

mggrsvg::_handleImage, image, lun=long, indent=string

Handle IDLgrImage objects.

Parameters

image in required type=object

IDLgrImage object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handlePlot

mggrsvg::_handlePlot, plot, lun=long, indent=string

Handle IDLgrPlot objects.

Parameters

plot in required type=object

IDLgrPlot object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_handleAxis

mggrsvg::_handleAxis, axis, lun=long, indent=string

Handle IDLgrAxis objects.

Parameters

axis in required type=object

IDLgrAxis object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::_traverse

mggrsvg::_traverse, tree, lun=long, indent=string

Routine which is recursively called to traverse the object graphics hierarchy.

Parameters

tree in required type=object

object graphics element

Keywords

lun in required type=long

logical unit number of file to write output to

indent in required type=string

string to prefix each line of output by

top mggrsvg::draw

mggrsvg::draw [, tree]

Write the object graphics rooted at the specified scene or view.

Parameters

tree in optional type=object

scene or view object

top mggrsvg::setProperty

mggrsvg::setProperty, filename=filename, graphics_tree=graphics_tree, dimensions=dimensions, em=em, ex=ex, px=px, pt=pt, pc=pc, cm=cm, mm=mm, inches=inches, percentage=percentage

Set properties.

Keywords

filename

filename of file to write to

graphics_tree

default picture to draw

dimensions

dimensions of the drawing canvas in units specified by the EM, EX, PX, PT, PC, CM, MM, INCHES, PERCENTAGE property at the same time as the DIMENSIONS property is set; if no dimensions are specified, the canvas is scaled to fill the available area

em
ex
px
pt
pc
cm
mm
inches
percentage

top mggrsvg::getProperty

mggrsvg::getProperty, filename=filename, graphics_tree=graphics_tree, text_multipler=text_multipler, dimensions=dimensions, dimension_units=dimension_units

Get properties.

Keywords

filename

filename of file to write to

graphics_tree

default picture to draw

text_multipler
dimensions

dimensions of the drawing canvas in units specified by the EM, EX, PX, PT, PC, CM, MM, INCHES, PERCENTAGE property at the same time as the DIMENSIONS property is set; if no dimensions are specified, the canvas is scaled to fill the available area

dimension_units

top mggrsvg::cleanup

mggrsvg::cleanup

Free resources.

top mggrsvg::init

result = mggrsvg::init( [_extra=keywords])

Create an SVG destination.

Return value

1 if successful, 0 if fails

Keywords

_extra in optional type=keywords

any properties of the class

top mggrsvg__define

mggrsvg__define

Define instance variables.

File attributes

Modification date: Wed May 14 15:07:15 2014
Lines: 330
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.