Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

imit_model / AnyLogic / UsersManual(AnyLogic)

.pdf
Скачиваний:
141
Добавлен:
06.06.2015
Размер:
4.28 Mб
Скачать

AnyLogic V User’s Manual

To modify the content of a text box

1.Double-click the text.

2.Edit the content of the text.

3.Click the empty area of the diagram to store the modified text, or Press Esc to finish editing.

To create a multiline text, use properties of the text shape.

Following Java convention, the origin point of the text box is the bottom left corner of the first line.

Properties

Text – [optional] content of the text box.

Color – static value|[optional] dynamic expression of the text color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Font – the text font.

Choose – the button opens the Font dialog box for changing the font properties.

12.2.2.8 Pivot

Pivot is used to group animation shapes, rotate the group, and shift the coordinate system. By specifying dynamic properties of a pivot (X, Y, Rotation, etc.), you can move a group of shapes and rotate it around the pivot. A pivot itself is not visible.

To draw a pivot

1.Click the Pivot toolbar button, or

Choose Draw|Animation|Pivot from the main menu.

2.Click the place on the diagram where you want to put the pivot.

© 1992-2004 XJ Technologies http://www.xjtek.com

297

Chapter 12. Animation

To add/remove shapes from the pivot group

1.Right-click the pivot and choose Add/Remove Shapes from the popup menu.

2.Click on a shape to add/remove it to/from the pivot group.

3.Click the empty area to finish.

When a shape is added to a pivot group, the pivot becomes the origin of its dynamic coordinates, instead of the animation origin point (0,0). This can be used to shift the coordinate system for a part of an animation.

Properties

Custom shape template – if set, the group of shapes added to pivot is considered as a custom shape. You can create as many such custom shapes as you like at runtime.

Setup code – [optional] Java statements to be inserted at the end of the method setup() of the pivot class. The code is called during the set up phase of the pivot group. The set up phase is executed only once when the animation creates.

Update code – [optional] Java statements to be inserted at the end of the method update() of the pivot class. The code is called each time the pivot group is about to be redrawn.

Additional class code – [optional] Java code to be inserted into the pivot class declaration.

If a pivot point is used as a custom shape template, the shape is not created automatically, but you can create as many custom shapes as you need at runtime. For each custom shape, AnyLogic generates a class derived from the pivot class Group. The class has the shape name

– e.g., for the Pivot1 shape, the Pivot1 class is generated.

Note that the name of the pivot point used as a custom shape template should be capitalized.

You can modify properties of a custom shape and its shapes at runtime using the methods of the Group class (for more information, please consult AnyLogic Class Reference).

298

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

12.2.2.9 Encapsulated animation

To draw an encapsulated animation

1.Click the Encapsulated Animation toolbar button, or

Choose Draw|Animation|Encapsulated Animation from the main menu.

2.Click or drag a rectangle area on the diagram.

Properties

Object – name of the encapsulated object this shape refers to. In case the object is replicated, you may specify a particular element, e.g., cars-5.

Original size – if checked, the original size of the animation suppresses the size of the shape.

Lock aspect ratio – applicable to encapsulated animations with non-original size, keeps the ratio between height and width constant during resize operation.

12.2.3Indicators

Indicators visualize dynamically changing numerical values in a model.

12.2.3.1Arc indicator

To draw an arc indicator

1.Click the Arc Indicator toolbar button, or

Choose Draw|Animation|Arc Indicator from the main menu.

2.Click or drag the indicator area on the diagram.

Properties

Value to indicate – dynamic expression whose value is indicated.

Min value – [optional] minimum value of the indicator.

© 1992-2004 XJ Technologies http://www.xjtek.com

299

Chapter 12. Animation

Max value – [optional] maximum value of the indicator.

Value color – static value|[optional] dynamic expression of the value text color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Scale color – static value|[optional] dynamic expression of the scale text color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Show value – if checked, the current value is textually displayed at the bottom of the indicator.

Show scale – if checked, the scale is displayed.

The color setup of an arc indicator is the following. The inner area is filled with Fill color. The scale and the pointer are of Line color. The scale text is of Scale color, and the value text is of

Value color.

12.2.3.2Bar indicator

To draw a bar indicator

1.Click the Bar Indicator toolbar button, or

Choose Draw|Animation|Bar Indicator from the main menu.

2.Click or drag the indicator area on the diagram.

Properties

Value to indicate – dynamic expression whose value is indicated.

Vertical|Horizontal – orientation of the bar indicator.

Min value – [optional] minimum value of the indicator.

Max value – [optional] maximum value of the indicator.

Value color – static value|[optional] dynamic expression of the value color (java.awt.Color). If the checkbox is not checked, the static color is

300

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

transparent. If the expression evaluates to null, the dynamic color is transparent.

Scale color – static value|[optional] dynamic expression of the scale text color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Show value – if checked, the current value is textually displayed at the bottom of the indicator.

Show scale – if checked, the scale is displayed.

The color setup of a bar indicator is the following. The background bar area is filled with Fill color. The scale and the frame are of Line color. The scale text is of Scale color, and the value text and the value bar are of Value color.

12.2.3.3 Chart indicator

The chart indicator displays a dataset or a variable in one of the following forms: scatter, Gantt, pie chart, or bar chart.

To draw a chart indicator

1.Click the Chart Indicator toolbar button, or

Choose Draw|Animation|Chart Indicator from the main menu.

2.Click or drag the indicator area on the diagram.

Properties

Value to indicate – dynamic expression whose value is indicated.

Type – the type of the chart: Scatter, Gantt, Pie Chart, or Bar Chart.

Window size – displayed time window or number of samples (for scatters and Gantt charts).

Min value – [optional] minimum value of the indicator.

Max value – [optional] maximum value of the indicator.

Min color – minimum color (for Gantt charts)

© 1992-2004 XJ Technologies http://www.xjtek.com

301

Chapter 12. Animation

Max color – maximal color (for Gantt charts)

Value color – static value|[optional] dynamic expression of the scatter line color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Scale color – static value|[optional] dynamic expression of the scale text color (java.awt.Color). If the checkbox is not checked, the static color is transparent. If the expression evaluates to null, the dynamic color is transparent.

Show value – if checked, the current value is textually displayed at the bottom of the indicator.

Show scale – if checked, the scale is displayed.

The color setup of a chart indicator is the following. The background area is filled with Fill color. The scale and the frame are of Line color. The scale text is of Scale color, and the scatter line is of Value color.

12.2.4Controls

AnyLogic offers a set of controls (buttons, checkboxes, edit boxes, etc.) for creating interactive animations.

12.2.4.1Button

To draw a button

1.Click the Button toolbar button, or

Choose Draw|Animation|Button from the main menu.

2.Click or drag the button rectangle on the diagram.

Properties

Label – [optional] button text displayed on the screen.

302

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

Variable name – [optional] name of the variable in a model. The variable must be of boolean type. It is true if the button is being pressed by the user, and false otherwise.

Enable expression – [optional] boolean expression determining whether the button is enabled or disabled.

Event handling code – [optional] code to be executed when the button is clicked.

12.2.4.2Check box

To draw a check box

1.Click the Check Box toolbar button, or

Choose Draw|Animation|Check Box from the main menu.

2.Click or drag the check box area on the diagram.

Properties

Label – [optional] check box text displayed on the screen.

Variable name – [optional] name of the variable in a model. The variable must be of boolean type. It is true if the check box is checked and false otherwise.

Enable expression – [optional] boolean expression determining whether the check box is enabled or disabled.

Event handling code – [optional] code to be executed when the check box is clicked.

12.2.4.3Radio buttons

To draw a group of radio buttons

1.Click the Radio Buttons toolbar button, or

Choose Draw|Animation|Radio Buttons from the main menu.

2.Click or drag the shape area on the diagram.

© 1992-2004 XJ Technologies http://www.xjtek.com

303

Chapter 12. Animation

Properties

Label – [optional] text of the group box containing the radio buttons.

Variable name – [optional] name of the variable in a model. The variable must be of type double. When you choose a radio button, the variable is set to the value associated with that radio button.

Enable expression – [optional] boolean expression determining whether the group box is enabled or disabled.

Orientation – either Vertical or Horizontal. Determines how the radio buttons are arranged.

Button-Value – list of radio buttons and double values associated with them.

Event handling code – [optional] code to be executed when any of the radio buttons is clicked.

12.2.4.4Slider

To draw a slider

1.Click the Slider toolbar button, or

Choose Draw|Animation|Slider from the main menu.

2.Click or drag the slider area on the diagram.

Properties

Label – [optional] slider label displayed on the screen.

Variable name – [optional] name of the variable in a model. The variable must be of type double. It reflects the position of the slider set by the user. The value is a linear interpolation between Min value and Max value.

Enable expression – [optional] boolean expression determining whether the slider is enabled or disabled.

Orientation – orientation of the slider, either Vertical or Horizontal.

Min value – [optional] minimum value of the slider.

Max value – [optional] maximum value of the slider.

304

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

Event handling code – [optional] code to be executed when the user changes the slider position.

12.2.4.5Edit box

To draw an edit box

1.Click the Edit Box toolbar button, or

Choose Draw|Animation|Edit Box from the main menu.

2.Click or drag the edit box on the diagram.

Properties

Label – [optional] edit box label displayed on the screen.

Variable name – [optional] name of the variable in a model. The variable must be of type java.lang.String. It reflects the content of the edit box entered by the user.

Enable expression – [optional] boolean expression determining whether the edit box is enabled or disabled.

Event handling code – [optional] code to be executed when the user changes text in the edit box.

12.2.4.6 Handle

Handle is a moveable rectangle. The user may move a handle in an animation window, and the variables specified in the properties X and Y of the handle change correspondingly. You cannot specify expressions in the properties X and Y. You must specify single variables.

To draw a handle

1.Click the Handle toolbar button, or

Choose Draw|Animation|Handle from the main menu.

2.Click the place on the diagram where you want to put the handle.

© 1992-2004 XJ Technologies http://www.xjtek.com

305

Chapter 12. Animation

Properties

Event handling code – [optional] code to be executed when the user moves the handle.

12.2.5Writing code for an animation

You can write code for the animation object in the Code window of the animation.

To open the Code window of an animation

1.In the Project window, right-click the Code item in the animation subtree of workspace tree and choose Open Code from the popup menu, or

Double-click the Code item in the animation subtree.

The Code window of the animation is displayed (see Figure 146)

Figure 146. Code window of an animation

The Code window has the following sections, where you can specify your own Java code to be executed on different occurrences:

306

© 1992-2004 XJ Technologies http://www.xjtek.com

Соседние файлы в папке AnyLogic