\documentclass{article} \usepackage{open-axiom} \begin{document} \title{\$SPAD/src/algebra viewDef.spad} \author{James Wen} \maketitle \begin{abstract} \end{abstract} \eject \tableofcontents \eject \section{package VIEWDEF ViewDefaultsPackage} <>= )abbrev package VIEWDEF ViewDefaultsPackage ++ Author: Jim Wen ++ Date Created: 15 January 1990 ++ Date Last Updated: ++ Basic Operations: pointColorDefault, lineColorDefault, axesColorDefault, ++ unitsColorDefault, pointSizeDefault, viewPosDefault, viewSizeDefault, ++ viewDefaults, viewWriteDefault, viewWriteAvailable, var1StepsDefault, ++ var2StepsDefault, tubePointsDefault, tubeRadiusDefault ++ Related Constructors: ++ Also See: ++ AMS Classifications: ++ Keywords: ++ References: ++ Description: ViewportDefaultsPackage describes default and user definable ++ values for graphics ViewDefaultsPackage():Exports == Implementation where I ==> Integer C ==> Color PAL ==> Palette L ==> List S ==> String E ==> Expression PI ==> PositiveInteger NNI ==> NonNegativeInteger SF ==> DoubleFloat B ==> Boolean writeAvailable ==> (["PIXMAP","BITMAP","POSTSCRIPT","IMAGE"]::L S) -- need not worry about case of letters Exports ==> with pointColorDefault : () -> PAL ++ pointColorDefault() returns the default color of points in a 2D ++ viewport. pointColorDefault : PAL -> PAL ++ pointColorDefault(p) sets the default color of points in a 2D viewport ++ to the palette p. lineColorDefault : () -> PAL ++ lineColorDefault() returns the default color of lines connecting ++ points in a 2D viewport. lineColorDefault : PAL -> PAL ++ lineColorDefault(p) sets the default color of lines connecting points ++ in a 2D viewport to the palette p. axesColorDefault : () -> PAL ++ axesColorDefault() returns the default color of the axes in a ++ 2D viewport. axesColorDefault : PAL -> PAL ++ axesColorDefault(p) sets the default color of the axes in a 2D ++ viewport to the palette p. unitsColorDefault : () -> PAL ++ unitsColorDefault() returns the default color of the unit ticks in ++ a 2D viewport. unitsColorDefault : PAL -> PAL ++ unitsColorDefault(p) sets the default color of the unit ticks in ++ a 2D viewport to the palette p. pointSizeDefault : () -> PI ++ pointSizeDefault() returns the default size of the points in ++ a 2D viewport. pointSizeDefault : PI -> PI ++ pointSizeDefault(i) sets the default size of the points in a 2D ++ viewport to i. viewPosDefault : () -> L NNI ++ viewPosDefault() returns the default X and Y position of a ++ viewport window unless overriden explicityly, newly created ++ viewports will have this X and Y coordinate. viewPosDefault : L NNI -> L NNI ++ viewPosDefault([x,y]) sets the default X and Y position of a ++ viewport window unless overriden explicityly, newly created ++ viewports will have th X and Y coordinates x, y. viewSizeDefault : () -> L PI ++ viewSizeDefault() returns the default viewport width and height. viewSizeDefault : L PI -> L PI ++ viewSizeDefault([w,h]) sets the default viewport width to w and height ++ to h. viewDefaults : () -> Void ++ viewDefaults() resets all the default graphics settings. viewWriteDefault : () -> L S ++ viewWriteDefault() returns the list of things to write in a viewport ++ data file; a viewAlone file is always generated. viewWriteDefault : L S -> L S ++ viewWriteDefault(l) sets the default list of things to write in a ++ viewport data file to the strings in l; a viewAlone file is always ++ genereated. viewWriteAvailable : () -> L S ++ viewWriteAvailable() returns a list of available methods for writing, ++ such as BITMAP, POSTSCRIPT, etc. var1StepsDefault : () -> PI ++ var1StepsDefault() is the current setting for the number of steps to ++ take when creating a 3D mesh in the direction of the first defined ++ free variable (a free variable is considered defined when its ++ range is specified (e.g. x=0..10)). var2StepsDefault : () -> PI ++ var2StepsDefault() is the current setting for the number of steps to ++ take when creating a 3D mesh in the direction of the first defined ++ free variable (a free variable is considered defined when its ++ range is specified (e.g. x=0..10)). var1StepsDefault : PI -> PI ++ var1StepsDefault(i) sets the number of steps to take when creating a ++ 3D mesh in the direction of the first defined free variable to i ++ (a free variable is considered defined when its range is specified ++ (e.g. x=0..10)). var2StepsDefault : PI -> PI ++ var2StepsDefault(i) sets the number of steps to take when creating a ++ 3D mesh in the direction of the first defined free variable to i ++ (a free variable is considered defined when its range is specified ++ (e.g. x=0..10)). tubePointsDefault : PI -> PI ++ tubePointsDefault(i) sets the number of points to use when creating ++ the circle to be used in creating a 3D tube plot to i. tubePointsDefault : () -> PI ++ tubePointsDefault() returns the number of points to be used when ++ creating the circle to be used in creating a 3D tube plot. tubeRadiusDefault : Float -> SF -- current tube.spad asks for SF ++ tubeRadiusDefault(r) sets the default radius for a 3D tube plot to r. tubeRadiusDefault : () -> SF ++ tubeRadiusDefault() returns the radius used for a 3D tube plot. Implementation ==> add import Color() import Palette() --import StringManipulations() defaultPointColor : Reference(PAL) := ref bright red() defaultLineColor : Reference(PAL) := ref pastel green() --bright blue() defaultAxesColor : Reference(PAL) := ref dim red() defaultUnitsColor : Reference(PAL) := ref dim yellow() defaultPointSize : Reference(PI) := ref(3::PI) defaultXPos : Reference(NNI) := ref(0::NNI) defaultYPos : Reference(NNI) := ref(0::NNI) defaultWidth : Reference(PI) := ref(400::PI) defaultHeight : Reference(PI) := ref(400::PI) defaultThingsToWrite : Reference(L S) := ref([]::L S) defaultVar1Steps : Reference(PI) := ref(27::PI) defaultVar2Steps : Reference(PI) := ref(27::PI) defaultTubePoints : Reference(PI) := ref(6::PI) defaultTubeRadius : Reference(SF) := ref(convert(0.5)@SF) defaultClosed : Reference(B) := ref(false) --%Viewport window dimensions specifications viewPosDefault() == [deref defaultXPos,deref defaultYPos] viewPosDefault l == #l < 2 => error "viewPosDefault expects a list with two elements" [setref(defaultXPos,first l),setref(defaultYPos,last l)] viewSizeDefault() == [deref defaultWidth,deref defaultHeight] viewSizeDefault l == #l < 2 => error "viewSizeDefault expects a list with two elements" [setref(defaultWidth,first l),setref(defaultHeight,last l)] viewDefaults == defaultPointColor : Reference(PAL) := ref bright red() defaultLineColor : Reference(PAL) := ref pastel green() --bright blue() defaultAxesColor : Reference(PAL) := ref dim red() defaultUnitsColor : Reference(PAL) := ref dim yellow() defaultPointSize : Reference(PI) := ref(3::PI) defaultXPos : Reference(NNI) := ref(0::NNI) defaultYPos : Reference(NNI) := ref(0::NNI) defaultWidth : Reference(PI) := ref(400::PI) defaultHeight : Reference(PI) := ref(427::PI) --%2D graphical output specifications pointColorDefault() == deref defaultPointColor pointColorDefault p == setref(defaultPointColor,p) lineColorDefault() == deref defaultLineColor lineColorDefault p == setref(defaultLineColor,p) axesColorDefault() == deref defaultAxesColor axesColorDefault p == setref(defaultAxesColor,p) unitsColorDefault() == deref defaultUnitsColor unitsColorDefault p == setref(defaultUnitsColor,p) pointSizeDefault() == deref defaultPointSize pointSizeDefault x == setref(defaultPointSize,x) --%3D specific stuff var1StepsDefault() == deref defaultVar1Steps var1StepsDefault i == setref(defaultVar1Steps,i) var2StepsDefault() == deref defaultVar2Steps var2StepsDefault i == setref(defaultVar2Steps,i) tubePointsDefault() == deref defaultTubePoints tubePointsDefault i == setref(defaultTubePoints,i) tubeRadiusDefault() == deref defaultTubeRadius tubeRadiusDefault f == setref(defaultTubeRadius,convert(f)@SF) --%File output stuff viewWriteAvailable() == writeAvailable viewWriteDefault() == deref defaultThingsToWrite viewWriteDefault listOfThings == thingsToWrite : L S := [] for aTypeOfFile in listOfThings repeat if negative?(writeTypeInt := position(upperCase aTypeOfFile,viewWriteAvailable())) then sayBrightly([" > ",concat(aTypeOfFile, " is not a valid file type for writing a viewport")])$Lisp else thingsToWrite := append(thingsToWrite,[aTypeOfFile]) setref(defaultThingsToWrite,thingsToWrite) @ \section{License} <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are --met: -- -- - Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- - Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- -- - Neither the name of The Numerical ALgorithms Group Ltd. nor the -- names of its contributors may be used to endorse or promote products -- derived from this software without specific prior written permission. -- --THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS --IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED --TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A --PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER --OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, --EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, --PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @ <<*>>= <> <> @ \eject \begin{thebibliography}{99} \bibitem{1} nothing \end{thebibliography} \end{document}