3.5.3 - PX Diffraction Simulations - JdlPXSimulations

John W. Campbell

3.5.3.1 Introduction

This class provides an object to display PX Rotation or Laue image diffraction patterns. It supports basically two types of display, a colour coded static display and an interactive display with a slider to vary selected parmeters to show their effect on the diffraction pattern.

Class, fields, constructor and methods:

Class Details
Accessible Fields
Constructor
Operational Methods
Resource Methods
Standard Positioning and Sizing
Overriden Superclass Methods

3.5.3.2 Class Details

Package:
Jdl.JdlView;
Class name:
JdlPXSimulations
Class definition:
public class JdlPXSimulations
Extends:
JPanel
Implements:
JdlDrawPanelDrawer
JdlFramedPanelDrawer
JdlButtonDrawer
ActionListener
MouseListener
MouseMotionListener
JdlViewObject
Printable
Actions:
none

3.5.3.3 Accessible Fields

The following accessible fields have been defined:

public final static int ROTATION
Simulation type: Rotation simulation.
public final static int LAUE
Simulation type: Laue simulation.
public final static int COLOUR
Display option: Colour.
public final static int INTERACTIVE
Display option: Interactive.
public final static int COLOUR_GNOMONIC
Display option: Colour - Gnomonic projection for Laue.
public final static int INTERACTIVE_GNOMONIC
Display option: Interactive - Gnomonic projection for Laue.
public final static int RESIZE_NONE
Resize option - do not resize pattern area.
public final static int RESIZE_ZOOM
Resize option - zoom image on resize - keep aspect ratio.
static final long serialVersionUID
public final static int PREFERRED
Size Constraint: preferred size
public final static int FREE
Size/Location Constraint: free

3.5.3.4 Constructor

3.5.3.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

3.5.3.4.2 Standard constructor

Constructs a JdlPXSimulations object with the required resources. The object is constructed either to display Rotation simulations or Laue simulations.

Constructor Definition:
public JdlPXSimulations (int type, int size, int rsz_opt, JdlViewOptions view_opts)
Parameters List:
type
Simulation type:
= 1, Rotation simulation
= 2, Laue simulation
(May use ROTATION, LAUE)
size
The required size for the pattern display area of the object (odd number - even given it will be increased by 1).
rsz_opt
Flag indicating required handling if the object is resized:
= 0, Do not resize the pattern area
= 1, Resize pattern - keep aspect ratio
view_opts
Object to set non-default options for borders, active strip, colours and fonts.

3.5.3.5 Operational Methods

3.5.3.5.1 Introduction

This section contains the main methods used with normal operation of the object.

Methods:

Get display type - selectedDisplayType
Get display option - selectedDisplayOption
Predict rotation data - predictRotationData
Predict rotation data - predictRotationData
Set rotation prediction - setRotationPrediction
Set rotation prediction - setRotationPrediction
Predict Laue data - predictLaueData
Predict Laue data - predictLaueData
Set Laue prediction - setLauePrediction
Set Laue prediction - setLauePrediction
Clear predictions - clearPredictions

3.5.3.5.2 Get display type - selectedDisplayType

This method gets the last selected display type (Rotation or Laue).

Method Definition:
public int selectedDisplayType()
Parameters List:
none
Method Return:
The display type:
= 1, Rotation
= 2, Laue
(May be ROTATION, LAUE)

3.5.3.5.3 Get display option - selectedDisplayOption

This method gets the last selected display option.

Method Definition:
public int selectedDisplayOption()
Parameters List:
none
Method Return:
The display option:
= 1, Colour
= 2, Interactive
= 3, Colour Gnonomic (Laue only)
= 4, Interactive Gnonomic (Laue only)

3.5.3.5.4 Predict rotation data - predictRotationData

This method generates, internally, the predictions for the colour and interactive options for rotation diffraction data.

Method Definition:
public void predictRotationData(int disp_opt, JdlPositionedDetector posdet, JdlPositionedCrystal poscrys, int icrys, int irange, double rotstart, double oscang, int imgnum, double rmin, double xmin, double xmax, double ymin, double ymax,int iord, double multfac)
Parameters List:
disp_opt
Display option:
= 1, Colour
= 2, Interactive
(May use COLOUR, INTERACTIVE)
posdet
JdlPositionedDetector object with parameters used in the reflection prediction.
poscrys
JdlPositionedCrystal object with parameters used in the reflection prediction.
icrys
The crystal number (The image may be identified by the crystal number and image number).
irange
A rotation range number for which 'rotstart' is the start angle.
rotstart
The start rotation angle in degrees (see also imgnum).
oscang
The oscillation angle in degrees.
imgnum
The number of the image for which the prediction is to be carried out from 1 up (The rotation range used will be from rotstart + (imgnum-1)*oscang to rotstart + imgnum*oscang).
rmin
Minimum radius for prediction in mm.
xmin
Minimum 'x' limit for prediction in mm (ignored if xmin = xmax)
xmax
Maximum 'x' limit for prediction in mm (ignored if xmax = xmin)
ymin
Minimum 'y' limit for prediction in mm (ignored if ymin = ymax)
ymax
Maximum 'y' limit for prediction in mm (ignored if ymax = ymin)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
multfac
Over-prediction factor for interactive plots (>1.0). The oscillation angle, mosaicity, beam divergences and dispersions will be multiplied by this factor for the prediction for interactive plots and the required data to be displayed will be calculated from the data predicted.

3.5.3.5.5 Predict rotation data - predictRotationData

This method generates, internally, the predictions for the colour and interactive options for rotation diffraction data.

Method Definition:
public void predictRotationData(int disp_opt, JdlDiffractionDataModule ddm, int iset, int irange, int imgnum, int iord, double multfac)
Parameters List:
disp_opt
Display option:
= 1, Colour
= 2, Interactive
(May use COLOUR, INTERACTIVE)
ddm
JdlDiffractionDataModule object with parameters used in the reflection prediction.
iset
Set number within DDM file.
irange
The rotation range number.
imgnum
Image number within the requested rotation range (if <=0 no check will be made on the image number in the reflection data records).
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
multfac
Over-prediction factor for interactive plots (>1.0). The oscillation angle, mosaicity, beam divergences and dispersions will be multiplied by this factor for the prediction for interactive plots and the required data to be displayed will be calculated from the data predicted.

3.5.3.5.6 Set rotation prediction - setRotationPrediction

This method sets the predicted data to be displayed together with data which may be used if the print option is invoked.

Method Definition:
public void setRotationPrediction (JdlPredictedReflectionsList reflist, int disp_opt, int iord, int crys_num, int imgnum, double oscang, JdlPositionedDetector posdet, JdlPositionedCrystal poscrys, JdlPredictedReflectionsList reflist_interactive, double rotstart, double multfac)
Parameters List:
reflist
Predicted reflections list. This is an object of type JdlPredictedReflectionsList for rotation image data.
disp_opt
Display option:
= 1, Colour
= 2, Interactive
(May use COLOUR, INTERACTIVE)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
crys_num
Crystal number (if <=0 no check will be made on the crystal number in the reflection data records - otherwise it must match that used in the predicted reflections list).
imgnum
Image number/identifier (if <=0 no check will be made on the image number in the reflection data records - otherwise it must match that used in the predicted reflections list).
oscang
Oscillation angle used in the prediction
posdet
JdlPositionedDetector object with parameters used in the reflection prediction.
poscrys
JdlPositionedCrystal object with parameters used in the reflection prediction.
reflist_interactive
Predicted reflection list for the interactive simulation plot; may be null if not required.
rotstart
Start angle for rotation used in calculating the interactive predicted reflection list if given.
multfac
Over-prediction factor for the oscillation range, mosaicity, beam divergences and dispersions used in calculating the interactive predicted reflection list if given.

3.5.3.5.7 Set rotation prediction - setRotationPrediction

This method sets the predicted data to be displayed together with data which may be used if the print option is invoked.

Method Definition:
public void setRotationPrediction (JdlPredictedReflectionsList reflist, int disp_opt, int iord, JdlDiffractionDataModule ddm, int iset, int crys_num, int imgnum, JdlPredictedReflectionsList reflist_interactive, double rotstart, double multfac)
Parameters List:
reflist
Predicted reflection list. This is an object of type JdlPredictedReflectionsList for rotation image data.
disp_opt
Display option:
= 1, Colour
= 2, Interactive
(May use COLOUR, INTERACTIVE)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
ddm
JdlDiffractionDataModule object with parameters used in the reflection prediction (if null details will not be printed).
iset
Set number within DDM file.
crys_num
Crystal number (if <=0 no check will be made on the crystal number in the reflection data records - otherwise it must match that used in the predicted reflections list).
imgnum
Image number/identifier (if <=0 no check will be made on the image number in the reflection data records - otherwise it must match that used in the predicted reflections list).
reflist_interactive
Predicted reflection list for the interactive simulation plot; may be null if not required.
rotstart
Start angle for rotation used in calculating the interactive predicted reflection list if given.
multfac
Over-prediction factor for the oscillation range, mosaicity, beam divergences and dispersions used in calculating the interactive predicted reflection list if given.

3.5.3.5.8 Predict Laue data - predictLaueData

This method generates, internally, the predictions for the colour and interactive options for rotation diffraction data.

Method Definition:
public void predictLaueData(int disp_opt, JdlPositionedDetector posdet, JdlPositionedCrystal poscrys, int icrys, int irange, double rotstart, double ang_inc, int imgnum, double rmin, double xmin, double xmax, double ymin, double ymax,int iord, double multfac, double limfac, double gnomr)
Parameters List:
disp_opt
Display option:
= 1, Colour
= 2, Interactive
= 3, Colour - Gnomonic projection
= 4, Interactive - Gnomonic projection
(May use COLOUR, INTERACTIVE, COLOUR_GNOMONIC, COLOUR_INTERACTIVE)
posdet
JdlPositionedDetector object with parameters used in the reflection prediction.
poscrys
JdlPositionedCrystal object with parameters used in the reflection prediction.
icrys
The crystal number (The image may be identified by the crystal number and image number).
irange
A rotation range number for which 'rotstart' is the start angle.
rotstart
The start rotation angle in degrees (see also imgnum).
ang_inc
The rotation angle increment in degrees.
imgnum
The number of the image for which the prediction is to be carried out from 1 up (The rotation angle used will be rotstart + (imgnum-1)*ang_inc.
rmin
Minimum radius for prediction in mm.
xmin
Minimum 'x' limit for prediction in mm (ignored if xmin = xmax)
xmax
Maximum 'x' limit for prediction in mm (ignored if xmax = xmin)
ymin
Minimum 'y' limit for prediction in mm (ignored if ymin = ymax)
ymax
Maximum 'y' limit for prediction in mm (ignored if ymax = ymin)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
multfac
Over-prediction factor for interactive plots (>1.0). The lambda-min and dmin values will be divided by this factor and the lambda-max will be multiplied by this factor for the prediction for interactive plots and the required data to be displayed will be calculated from the data predicted. For the interactive plots the other limit used will be calculated using the inverse of multfac.
limfac
The factor by which to extend the range of lambda-min, lambda-max, and dmin for interactive pattern displays using the JdlPXSimulations object (extends in opposite direction from multfac i.e. it increases lambda-min and dmin and decreases lambda-max).
gnomr
Radius for the section of the Laue pattern which may be displayed as a gnomonic projection (>=0.1). If gnomonic projections are not to be used, then input 0.0.

3.5.3.5.9 Predict Laue data - predictLaueData

This method generates, internally, the predictions for the colour and interactive options for Laue diffraction data.

Method Definition:
public void predictLaueData(int disp_opt, JdlDiffractionDataModule ddm, int iset, int irange, int imgnum, int iord, double multfac, double limfac, double gnomr)
Parameters List:
disp_opt
Display option:
= 1, Colour
= 2, Interactive
= 3, Colour - Gnomonic projection
= 4, Interactive - Gnomonic projection
(May use COLOUR, INTERACTIVE, COLOUR_GNOMONIC, COLOUR_INTERACTIVE)
ddm
JdlDiffractionDataModule object with parameters used in the spot prediction.
iset
Set number within DDM file.
irange
The rotation range number.
imgnum
Image number within the requested rotation range.
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
multfac
Over-prediction factor for interactive plots (>1.0). The lambda-min and dmin values will be divided by this factor and the lambda-max will be multiplied by this factor for the prediction for interactive plots and the required data to be displayed will be calculated from the data predicted. For the interactive plots the other limit used will be calculated using the inverse of multfac.
limfac
The factor by which to extend the range of lambda-min, lambda-max, and dmin for interactive pattern displays using the JdlPXSimulations object (extends in opposite direction from multfac i.e. it increases lambda-min and dmin and decreases lambda-max).
gnomr
Radius for the section of the Laue pattern which may be displayed as a gnomonic projection (>=0.1). If gnomonic projections are not to be used, then input 0.0.

3.5.3.5.10 Set Laue prediction - setLauePrediction

This method sets the predicted data to be displayed together with data which may be used if the print option is invoked. As the data may need to be sorted an internal copy is made of the given spot lists.

Method Definition:
public void setLauePrediction (JdlPredictedLaueSpotsList spotlist, int disp_opt, int iord, int crys_num, int imgnum, JdlPositionedDetector posdet, JdlPositionedCrystal poscrys, JdlPredictedLaueSpotsList spotlist_interactive, double multfac, double limfac, double gnomr)
Parameters List:
spotlist
Predicted spots list. This is an object of type JdlPredictedLaueSpotsList for Laue image data.
disp_opt
Display option:
= 1, Colour
= 2, Interactive
= 3, Colour - Gnomonic projection
= 4, Interactive - Gnomonic projection
(May use COLOUR, INTERACTIVE, COLOUR_GNOMONIC, COLOUR_INTERACTIVE)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
crys_num
Crystal number (if <=0 no check will be made on the crystal number in the reflection data records - otherwise it must match that used in the predicted reflections list).
imgnum
Image number/identifier (if <=0 no check will be made on the image number in the reflection data records - otherwise it must match that used in the predicted reflections list).
posdet
JdlPositionedDetector object with parameters used in the reflection prediction.
poscrys
JdlPositionedCrystal object with parameters used in the reflection prediction.
spotlist_interactive
Predicted spots list for the interactive simulation plot; may be null if not required.
multfac
Over-prediction factor for the lambda-min, lambda-max and dmin values used in calculating the interactive predicted reflection list if given (lambda-min and dmin divided by this factor, lambda-max multiplied by this factor). For the interactive plots the other limit used will be calculated using the inverse of multfac.
limfac
The factor by which to extend the range of lambda-min, lambda-max, and dmin for interactive pattern displays using the JdlPXSimulations object (extends if opposite direction from multfac i.e. it increases lambda-min and dmin and decreases lambda-max).
gnomr
Radius for the section of the Laue pattern which may be displayed as a gnomonic projection (>=0.1). If gnomonic projections are not to be used, then input 0.0.

3.5.3.5.11 Set Laue prediction - setLauePrediction

This method sets the predicted data to be displayed together with data which may be used if the print option is invoked. As the data may need to be sorted an internal copy is made of the given spot lists.

Method Definition:
public void setLauePrediction (JdlPredictedLaueSpotsList spotlist, int disp_opt, int iord, JdlDiffractionDataModule ddm, int iset, int crys_num, int imgnum, JdlPredictedLaueSpotsList spotlist_interactive, double multfac, double limfac, double gnomr)
Parameters List:
spotlist
Predicted spot list. This is an object of type JdlPredictedLaueSpotsList for Laue image data.
disp_opt
Display option:
= 1, Colour
= 2, Interactive
= 3, Colour - Gnomonic projection
= 4, Interactive - Gnomonic projection
(May use COLOUR, INTERACTIVE, COLOUR_GNOMONIC, COLOUR_INTERACTIVE)
iord
Order of local detector axes flag (1-8). The first local axis will be set along the display 'x' direction on the screen (to the right) and the second local axis will be set along the display 'y' direction (down):
= 1, +ax1 +ax2
= 2, +ax1 -ax2
= 3, -ax1 +ax2
= 4, -ax1 -ax2
= 5, +ax2 +ax1
= 6, +ax2 -ax1
= 7, -ax2 +ax1
= 8, -ax2 -ax1
ddm
JdlDiffractionDataModule object with parameters used in the reflection prediction (if null details will not be printed).
iset
Set number within DDM file.
crys_num
Crystal number (if <=0 no check will be made on the crystal number in the reflection data records - otherwise it must match that used in the predicted reflections list).
imgnum
Image number/identifier (if <=0 no check will be made on the image number in the reflection data records - otherwise it must match that used in the predicted reflections list).
spotlist_interactive
Predicted spots list for the interactive simulation plot; may be null if not required.
multfac
Over-prediction factor for the lambda-min, lambda-max and dmin values used in calculating the interactive predicted reflection list if given (lambda-min and dmin divided by this factor, lambda-max multiplied by this factor). For the interactive plots the other limit used will be calculated using the inverse of multfac.
limfac
The factor by which to extend the range of lambda-min, lambda-max, and dmin for interactive pattern displays using the JdlPXSimulations object (extends if opposite direction from multfac i.e. it increases lambda-min and dmin and decreases lambda-max).
gnomr
Radius for the section of the Laue pattern which may be displayed as a gnomonic projection (>=0.1). If gnomonic projections are not to be used, then input 0.0.

3.5.3.5.12 Clear predictions - clearPredictions

Clear the data from any current predictions.

Method Definition:
public void clearPredictions()
Parameters List:
none

3.5.3.6 Resource Methods

This section has methods to set/get the resources associated with the object determining its appearance and mode of action.

3.5.3.7 Standard Positioning and Sizing

3.5.3.7.1 Introduction

This section contains the standard methods for positioning and sizing JdlView objects and getting the current minimum height and width values.

Methods:

Set position constraints - setLocationConstraints
Set size constraints - setSizeConstraints
Set minimum height - setMinimumHeight
Set minimum width - setMinimumWidth

3.5.3.7.2 Set position constraints - setLocationConstraints

Set constraints on the Jdl object positioning.

Method Definition:
public void setLocationConstraints (int constraint_x, int constraint_y)
Parameters List:
constraint_x
Constrain the Jdl Object 'x' position = the required Jdl Object 'x' position (overrides setLocation method) or FREE if the 'x' position may be set by the setLocation method and hence possibly by the layout manager.
constraint_y
Constrain the Jdl Object 'y' position = the required the Jdl Object 'y'position (overrides setLocation method) or FREE if the 'y' position may be set by the setLocation method and hence possibly by the layout manager.

3.5.3.7.3 Set size constraints - setSizeConstraints

Set constraints on the Jdl Object resizing permitted.

Method Definition:
public void setSizeConstraints (int constraint_w, int constraint_h)
Parameters List:
constraint_w
Constrain the Jdl Object width = the required Jdl Object width, or PREFERRED (default) if the width is to be calculated from the current resources, or FREE if the width may be resized to anything greater than the minimum width required.
constraint_h
Constrain the Jdl Object height = the required Jdl Object height, or PREFERRED (default) if the height is to be calculated from the current resources, or FREE if the height may be resized to anything greater than the minimum height required.

3.5.3.7.4 Set minimum height - setMinimumHeight

Set the minimum height resource.

Method Definition:
public void setMinimumHeight(int minh)
Parameters List:
minh
The minimum height required for the object (ignored if less than that required by the minimum layout) (default = 0).

3.5.3.7.5 Set minimum width - setMinimumWidth

Set the minimum width resource.

Method Definition:
public void setMinimumWidth(int minw)
Parameters List:
minh
The minimum width required for the object (ignored if less than that required by the minimum layout) (default = 0).

3.5.3.8 Overriden Superclass Methods

3.5.3.8.1 Introduction

This section contains methods which override the corresponding superclass methods. These are basically standard for JdlView objects and comprise methods to set background and foreground colours and to get the minimum and preferred sizes for the object. (The paintComponent method is also over-ridden but is not normally called by the user).

Methods:

Set background - setBackground
Set background colours - setBackground
Set foreground - setForeground
Get minimum size - getMinimumSize
Get preferred size - getPreferredSize

3.5.3.8.2 Set background - setBackground

This method sets the background colour resource.

Method Definition:
public void setBackground (Color c)
Parameters List:
c
The color to become this object's background color.

3.5.3.8.3 Set background colours - setBackground

This method sets the background colour resource and brighter and darker shades of that colour (e.g. for 3-D frames).

Method Definition:
public void setBackground (Color c, Color brighter, Color darker)
Parameters List:
c
The background colour.
brighter
A brighter shade of the background colour.
darker
A darker shade of the background colour.

3.5.3.8.4 Set foreground - setForeground

This method sets the foreground colour resource.

Method Definition:
public void setForeground (Color c)
Parameters List:
c
The color to become this object's foreground color.

3.5.3.8.5 Get minimum size - getMinimumSize

This method returns the minimum size of the component.

Method Definition:
public Dimension getMinimumSize()
Parameters List:
none

3.5.3.8.6 Get preferred size - getPreferredSize

This method returns the preferred size of the component.

Method Definition:
public Dimension getPreferredSize()
Parameters List:
none

⇑ Up 3   ⇑ Up 2   ⇑ Up 1   ⇑ Top of this