Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

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

.\

cgsurface.pro

Graphics


The purpose of cgSurface is to create a window where a surface is displayed. Surfaces can be wire-framed, shaded surfaces, and surfaces with texture maps draped on top of them, among other types of surfaces. LEFT mouse button rotates the surface, MIDDLE mouse button zooms out from the surface, RIGHT mouse button zoom into the surface. Clicking on the surface axes will allow the user to move or translate the surface, and clicking on the plot title will allow the user to move the title.

Examples

Use as you would use the IDL SURFACE of SHADE_SURF command:

data = Dist(200) LoadCT, 33 cgSurface, data cgSurface, data, /Elevation_Shading cgSurface, data, /Shaded cgSurface, data, /Shaded, Texture_Image=cgDemoData(16) Setting up the initial surface rotation. IDL> T3D, /RESET, ROTATE=[0, 0, 30] IDL> T3D, ROTATE=[-90, 0, 0] IDL> T3D, ROTATE=[0, 30, 0] IDL> T3D, ROTATE=[30, 0, 0] IDL> cgSurface, cgDemoData(2), Transform=!P.T

Author information

Author

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright

Copyright (c) 2010-2014, Fanning Software Consulting, Inc.

History

Change History:

Completely re-written, 26 November 2010 from old cgSURFACE program. DWF. Added ability to translate the surface by clicking on an axis. 28 Nov 2010. DWF. Fixed a problem with light controls in which the light controls didn't show the current light color. 28 Nov 2010. DWF. I was ANDing [XYZ]Style keywords with 8 instead of 4 for hidded axes. Fixed. 4 Jan 2011. DWF. Added Axes ON/OFF button. 4 Jan 2011. DWF. Rotation is throwing underflow warnings, so switched to code that surpress these warnings. 26 Aug 2011. DWF Added TRANSFORM keyword to allow the initial surface to be rotated to user specifications. 26 Sept 2011. DWF. Changed FSC_Normalize to cgNormalize to reflect new name. 6 Feb 2013. DWF. Axes titles are now changing size with the CHARSIZE keyword, as they are supposed to. 4 Nov 2013. DWF. Fixed a problem with the Light Controller when trying to set a color. 21 Mar 2014. DWF. Added checks to make sure the surface ranges are not zero. 8 March 2014. DWF.

Routines

CW_Light_Control_Intensity_Events, event

Controls light intensity by handling selection events from the Intensity Value widget.

CW_Light_Control_Events, event

Controls light properties such as color, whether the light is on or off, etc.

result = CW_Light_Control(parent, theLight [, Color=bytarr] [, Event_Pro=string] [, Index=integer] [, LabelSize=integer] [, Name=string] [, SetColor_Name=string] [, UValue=UValue])

This is a compound widget that allows the user to manipulate various properties of a light object via a graphical user interface.

cgSurface_Light_Done, event

An event handler that destroys the light controller in the program.

cgSurface_Light_Controls_Event, event

An event handler that renders the light controller's graphics.

cgSurface_Light_Controls, event

An event handler that creates the graphical user interface for the light controller.

cgSurface_Axes_OnOff, event

An event handler that turns the surface axes on or off.

cgSurface_Bottom_OnOff, event

An event handler that turns the bottom color on or off.

cgSurface_Change_Colors, event

An event handler that changes the color tables for elevation shading.

cgSurface_Draw_Events, event

An event handler for draw events such as expose events and trackball events.

cgSurface_Elevation_Colors, event

An event handler changing the colors used in elevation shading.

cgSurface_Elevation_Shading, event

An event handler to set up elevation shading for the surface.

cgSurface_Exit, event

An event handler to destroy the GUI for this program.

cgSurface_Move_Surface, event

An event handler to allow the surface to move in the graphics window.

cgSurface_Move_Title, event

An event handler to allow the title to move in the graphics window.

cgSurface_Output, event

An event handler to allow the user to save the graphics window in a variety of output formats, including raster formats and PostScript.

cgSurface_Properties, event

An event handler to allow the user to change various surface properties.

cgSurface_Resize, event

An event handler to respond to window resizing events.

cgSurface_Skirt_OnOff, event

An event handler to turn the surface skirt on and off.

cgSurface_Style, event

An event handler to respond to events from the Style menu, changing style properties of the surface.

cgSurface_Cleanup, tlb

The cleanup routine for the program.

result = cgSurface_Aspect( [aspectRatio] [, MARGIN=float] [, WindowAspect=float])

A function for calculating the correct surface aspect ratio.

cgSurface, data [, x] [, y] [, Axiscolor=string] [, Background=string] [, /Block] [, Bottom=string] [, /Brewer] [, Charsize=float] [, Color=string] [, /Constrain_Aspect] [, CTable=integer] [, /Elevation_Shading] [, Font=string] [, /Hidden_Lines] [, Group_Leader=long] [, Palette=byte] [, /Reverse] [, /Shaded] [, Skirt=any] [, Style=integer] [, Texture_Image=byte] [, Title=string] [, TCharsize=float] [, TColor=string] [, Transform=4x4 double array] [, Vert_Colors=byte] [, XOffset=integer] [, XRange=float] [, XSize=interger] [, XTitle=string] [, YOffset=integer] [, YRange=float] [, YSize=integer] [, YTitle=string] [, ZRange=float] [, ZScale=float] [, ZTitle=string] [, _Extra=any]

The purpose of cgSurface is to create a window where a surface is displayed.

Routine details

top CW_Light_Control_Intensity_Events

CW_Light_Control_Intensity_Events, event

Controls light intensity by handling selection events from the Intensity Value widget.

Parameters

event in required

The event structure from the graphical user interface of the program.

top CW_Light_Control_Events

CW_Light_Control_Events, event

Controls light properties such as color, whether the light is on or off, etc.

Parameters

event in required

The event structure from the graphical user interface of the program.

top CW_Light_Control

result = CW_Light_Control(parent, theLight [, Color=bytarr] [, Event_Pro=string] [, Index=integer] [, LabelSize=integer] [, Name=string] [, SetColor_Name=string] [, UValue=UValue])

This is a compound widget that allows the user to manipulate various properties of a light object via a graphical user interface.

Parameters

parent in required

The parent widget of this compound widget.

theLight in required type=object

An object reference to a particular light object.

Keywords

Color in optional type=bytarr

A color triple representing the color of the light.

Event_Pro in optional type=string

The name of an event handler that will handle events for this widget.

Index in optional type=integer

A color table index number. If the Color keyword is not used, the color will be obtained from the colors loaded in the current color table at this color table index number.

LabelSize in optional type=integer

The size of the label widget used in the compound widget in pixels. If not specified, the "natural" size of the label widget is used.

Name in optional type=string

A name for this widget. Provided to help identify the widget in event handlers.

SetColor_Name in optional type=string

This keyword sets the UNAME property of the Set Color button in the interface. It's purpose is to help you identify that button in event handlers.

UValue in optional

A container to store any IDL variable needed by the user of this program.

top cgSurface_Light_Done

cgSurface_Light_Done, event

An event handler that destroys the light controller in the program.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Light_Controls_Event

cgSurface_Light_Controls_Event, event

An event handler that renders the light controller's graphics.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Light_Controls

cgSurface_Light_Controls, event

An event handler that creates the graphical user interface for the light controller.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Axes_OnOff

cgSurface_Axes_OnOff, event

An event handler that turns the surface axes on or off.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Bottom_OnOff

cgSurface_Bottom_OnOff, event

An event handler that turns the bottom color on or off.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Change_Colors

cgSurface_Change_Colors, event

An event handler that changes the color tables for elevation shading.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Draw_Events

cgSurface_Draw_Events, event

An event handler for draw events such as expose events and trackball events. The trackball uses the IDL-supplied TRACKBALL_DEFINE.PRO.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Elevation_Colors

cgSurface_Elevation_Colors, event

An event handler changing the colors used in elevation shading.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Elevation_Shading

cgSurface_Elevation_Shading, event

An event handler to set up elevation shading for the surface.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Exit

cgSurface_Exit, event

An event handler to destroy the GUI for this program.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Move_Surface

cgSurface_Move_Surface, event

An event handler to allow the surface to move in the graphics window.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Move_Title

cgSurface_Move_Title, event

An event handler to allow the title to move in the graphics window.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Output

cgSurface_Output, event

An event handler to allow the user to save the graphics window in a variety of output formats, including raster formats and PostScript.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Properties

cgSurface_Properties, event

An event handler to allow the user to change various surface properties.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Resize

cgSurface_Resize, event

An event handler to respond to window resizing events.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Skirt_OnOff

cgSurface_Skirt_OnOff, event

An event handler to turn the surface skirt on and off.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Style

cgSurface_Style, event

An event handler to respond to events from the Style menu, changing style properties of the surface.

Parameters

event in required

The event structure from the graphical user interface of the program.

top cgSurface_Cleanup

cgSurface_Cleanup, tlb

The cleanup routine for the program. Cleans everything up when the widget dies.

Parameters

tlb in required

The identifier of the widget that just died.

top cgSurface_Aspect

result = cgSurface_Aspect( [aspectRatio] [, MARGIN=float] [, WindowAspect=float])

A function for calculating the correct surface aspect ratio. A position in the window with this aspect ratio is returned.

Return value

A four-element POSITION array, giving the position in the window for a plot with this aspect ratio.

Parameters

aspectRatio in optional type=float default=1.0

The desired aspect ratio of the surface.

Keywords

MARGIN in optional type=float default=0.0

The desired margin around the edges of the window.

WindowAspect in optional type=float

The aspect ratio of the window the graphics are to be displayed in.

top cgSurface

cgSurface, data [, x] [, y] [, Axiscolor=string] [, Background=string] [, /Block] [, Bottom=string] [, /Brewer] [, Charsize=float] [, Color=string] [, /Constrain_Aspect] [, CTable=integer] [, /Elevation_Shading] [, Font=string] [, /Hidden_Lines] [, Group_Leader=long] [, Palette=byte] [, /Reverse] [, /Shaded] [, Skirt=any] [, Style=integer] [, Texture_Image=byte] [, Title=string] [, TCharsize=float] [, TColor=string] [, Transform=4x4 double array] [, Vert_Colors=byte] [, XOffset=integer] [, XRange=float] [, XSize=interger] [, XTitle=string] [, YOffset=integer] [, YRange=float] [, YSize=integer] [, YTitle=string] [, ZRange=float] [, ZScale=float] [, ZTitle=string] [, _Extra=any]

The purpose of cgSurface is to create a window where a surface is displayed. Surfaces can be wire-framed, shaded surfaces, and surfaces with texture maps draped on top of them, among other types of surfaces. LEFT mouse button rotates the surface, MIDDLE mouse button zooms out from the surface, RIGHT mouse button zoom into the surface. Clicking on the surface axes will allow the user to move or translate the surface, and clicking on the plot title will allow the user to move the title.

Parameters

data in required type=any

A two-dimensional array of data to be displayed.

x in optional type=any

A vector or two-dimensional array specifying the X coordinates of the surface grid.

y in optional type=any

A vector or two-dimensional array specifying the Y coordinates of the surface grid.

Keywords

Axiscolor in optional type=string default=black

The name of the axis color. By default, 'black'..

Background in optional type=string default=white

The name of the background color. By default, 'white'.

Block in optional type=boolean default=0

Set this keyword to make the program a blocking widget program.

Bottom in optional type=string default=COLOR

The name of the bottom color. By default, same as COLOR.

Brewer in optional type=boolean default=0

Set this keyword to indicate that the colortable (CTABLE) is to use Brewer color tables rather than IDL standard color tables.

Charsize in optional type=float default=1.0

The character size of the surface annotation. This value is multiplied times a 12 point character size.

Color in optional type=string default=blu6

The name of the data color.

Constrain_Aspect in optional type=boolean default=0

Set this keyword to maintain the aspect ratio of the Y size of the data to the Y size of the data. The default is to let the sizes conform to a unit square.

CTable in optional type=integer

The color table to use with the surface. The default is to use the current color table.

Elevation_Shading in optional type=boolean default=0

Set this keyword to put elevation shading into effect for the surface.

Font in optional type=string default=Helvetica

The name of the true-type font desired for axis annotation and the plot title. If undefined, the default is "Helvetica".

Hidden_Lines in optional type=boolean default=1

Set this keyword to turn hidden line removal on for the surface. Turned ON by default.

Group_Leader in optional type=long

Set this keyword to the identifier of a widget that will serve as the group leader for this widget program. When the group leader dies, this program will die, too.

Palette in optional type=byte

A 3x256 byte array (or 256x3) representing the colors for elevation shading. An alternative way of specifying the color table, instead of using the CTable keyword.

Reverse in optional type=boolean default=0

Set this keyword to reverse the color table set by CTABLE.

Shaded in optional type=boolean default=0

Set this keyword if you wish to display a shaded surface. The is the same as setting STYLE=2.

Skirt in optional type=any

Set this keyword to a Z value where a skirt will be drawn for the surface.

Style in optional type=integer default=1

Sets the style of the surface:

0 - Dot surface 1 - Wire mesh (the default) 2 - Shaded surface 3 - Parallel X lines 4 - Parallel Y line 5 - Wire mesh lego style 6 - Solid lego style

Texture_Image in optional type=byte

Set this keyword to a 2D or true-color image that will be overlaid on the surface as a texture map. If a 2D image is passed, the colortable specified with CTABLE will be used to construct a true-color image for the texture map.

Title in optional type=string

The title of the plot. It will be written "flat to the screen", rather than rotated.

TCharsize in optional type=float

The title character size. By default 1.25 times the Charsize.

TColor in optional type=string

The name of the title color. By default, the same as AxisColor.

Transform in optional type=4x4 double array

A homogeneous transformation matrix to be applied to the initial surface. Such a transformation matrix can be obtained, for example, with the T3D procedure.

Vert_Colors in optional type=byte

A vector of colors to be used to specify the color of a surface vertex. The vector may be of the form [n] where each entry is a color index, or of the form [3,n] where each 3-element row is an RGB color, or of the form [4,n] where each 4-element row is an RGBA color. To remove vertex colors after they have been set, set VERT_COLORS to a scalar. See the documentation for IDLgrSurface for additional details.

XOffset in optional type=integer default=50

The number of pixels the surface window should be offset in the X direction from the upper-left corner of the display.

XRange in optional type=float

The X data range of the data. Normally, just chosen from the data itself.

XSize in optional type=interger default=640

The X size of the initial surface window. By default, 640 pixels.

XStyle in hidden

The normal XSTYLE keyword.

XTitle in optional type=string

The text for the X axis of the surface plot.

YOffset in optional type=integer default=25

The number of pixels the surface window should be offset in the Y direction from the upper-left corner of the display.

YRange in optional type=float

The Y data range of the data. Normally, just chosen from the data itself.

YSize in optional type=integer default=512

The Y size of the initial surface window. By default, 640 pixels.

YStyle in hidden

The normal YSTYLE keyword.

YTitle in optional type=string

The text for the Y axis of the surface plot.

ZRange in optional type=float

The Z data range of the data. Normally, just chosen from the data itself.

ZScale in optional type=float default=1.0

A number between 0.001 and 1.0 that will "scale" the Z axis height. Default is 1.0.

ZStyle in hidden

The normal ZSTYLE keyword.

ZTitle in optional type=string

The text for the Z axis of the surface plot.

_Extra in optional type=any

Any keyword appropriate for the IDLgrSurface object is allowed in the program.

File attributes

Modification date: Fri Mar 27 11:07:36 2015
Lines: 2,045
Docformat: rst rst