MDL Programming Basic Methods
MDL Programming Basic Methods
9.2.1 MDL production of documents and resources File Analysis............. .................. 195
1.1.2 Notes
Note the meaning of the reader to understand the procedure, but also to enable
programmers to modify the program to understand the procedure functions. With the
forward slash and asterisk (/ *)
Note that the start; while with the opposite sign (* /) that the comment ended. Compiler
will not deal with annotations. MDL does not support nested comments.
In Micro Station V8, of course, can also be used double slash (/ /) on a single line for
comments.
Bentley \ Program \ Micro Station \ mdl \ include and going to find <mdl. h> file.
Or, we can put the file name in quotation marks, it informed the pretreatment program to
contain the file that contains the file description statements directory to find package
with the file.
# include "plbox.h" / * Generated by "rcomp-h plbox.r" * /
How do we know which one to use with documents? All the file names are listed in the
<<MDL 手册> "in the. For example, when we use
mdlText_extractShape time, it must contain <mselems. h> file. These documents can be
included within Micro Station
In the ... Bentley \ Program \ Micro Station \ mdl \ include directory to find.
/*----------------------------------------------------------------------
+
︱ Include Files ︱
+----------------------------------------------------------------------
*/
#include <mdl.h> /*system include files*/
#include <global.h>
#include <mselems.h>
#include <userfnc.h>
#include <rscdefs.h>
#include <tcb.h>
#include <plbox.h> /*Generated by rcomp -h plbox.r" */
Final an include file plbox.h should arouse attention because It consists resource file
compiled betrayals. We went second chapter further discussion
Resource file.
In Micro Station V8 in introduced new file type ". Fdf", they are function definition file
(Function Definition
File). These documents contain certain category MDL function prototypes definitions,
while another right include files reference Therefore, V8 programming
You will see we often simply procedures beginning contains these. Fdf document do.
Definition of variables
The term "variable" so the name and memory address linked. The amount of
memory needed to store the variable depends on the variable type. The term "address"
Is a variable storage address. For example, the value of an integer variable count is 20,
its address is given by the & count. That is, "&" symbol
No. Back to count the address, rather than count the value of, this is a very important
concept. Many programmers to understand the variables and due to an error
It addresses the meaning of the program generated many problems.
MDL is a language-sensitive pairs of uppercase and lowercase letters. When you define
a variable or function names should be firmly borne in mind. For example, the variable
linePts with LinePts different.
Variable description of the scope of the definition of variables for which part of
the program. In order to determine the scope of variables, an MDL program source code
according to the level Divided into many pieces.
A block can be a program or a function. The entire file can be considered as a
block. - Blocks can be nested in other blocks , So a block in the external variables are
defined by all nested blocks recognition. An internal block defined in the variable name
with an external block
Variable the same name.
In this case, the internal block variable will replace the external block variables,
but this is only limited in-house within the scope of the block.
In this case, the internal block variable is considered local variables. Their values and
their presence only by those who explain the function of the commitments that they
Recognition. Global variable was MDL program for your recognition of all the functions.
Static variables and automatic variables
Variable has a storage type. Categories decide how to store a variable storage, how
long it lives, as well as in the program where the variable names can be
Be referred to. If we described the function of a variable not do special treatment, it is an
automatic variable. This means that when we tune
With a function, this variable is automatically generated, when we leave this function
when it is abandoned. Sometimes, the need to retain the function assigned to local
variables
The final value of the static modifier static compiler directives stored from a call to the
next call to a local variable's value. Default
Variable is automatically variable. Global variables may be static (in the MDL source
module called by any recognized, but not by other source modules used).
If a global variable is not describe the static, it can also be used by other source
modules.In our Example PLBOX, we need to define two functions for all of our global
variables, we need to Can accommodate 128 to define a string variable textin, it is
noteworthy because the "type" buffer of 128 characters.
/*------------------------------------------------------------+
│ Private Global variables │
+------------------------------------------------------------*/
static char textin[128];
Dpoint3d pntP[2];
In this book does not include the interpretation of the standard C function. You can, in
many C language tutorial to find them. MDL supports the following standard C function:
File operations, input and output: fclose, leof, ferror, fflush, fSetc, fgets, fopen, fprintf,
fputc,fputs, fread, freopen, fscanf, fwrite, fseek, ftell, getc, printf, putc, remove, rename,
rewind,sscanf, setbuf, setvbuf, sprintf, tmpfile, tmpnam, ungetc, unlink, vfprintf, vprintf,
vsprintf.
In this book does not include the interpretation of the standard C function. You can, in
many C language tutorial to find them. MDL supports character classification and
conversion:
isalmum, isalpha, iscntrl, isdigit, isgraph, islowcr, isprint, ispuct, isspace,
isupper, isxdigit, toascii, tolower. toupper.
String Manipulation: strcat, strchr, strcmp, strcmpi, strcpy, strcspn, strlen, strlwr, strncat,
strncmp, strncpy, strpbrk, strrchr, strspn, strstr, strok, strupr.
Cuncun allocation, buffer management and data conversion: atof, atoi, atol, calloc, exit,
free, getenv,malloc, memchr, memcmp, memcpy, memmove, memset, rand, realloc,
srand, strlod, strol, strloul.
Math: acos, asin, atan, atan2, ceil, cos, cosh, exp, labs, flooy, fmod, frexp, log, log1O,
ldexp, ntodf, pow, sin, sinh, sqrt, tan, tanh.
Date and time: sctime, ctime, difftime, gmtime, localtime, strftime, time.
Variables: va_arg, va_end, va_start. MDL supports ANSI and K & R control variable
approach.
main function
Although not an MDL program must contain a main function, but there is no main
function of the situation is very few. In the MDL proceedings main function is to serve
three kinds of purposes:
Main ()
{
RscFileltandle rfHandle;
/*load our command table */
if(mdlparse_loadCommandTable (NULL)= NULL)
mdloutput_error ("Unable to load command table.”);
mdlResource_openFile (&rfHandle,NULL, FALSE);
mdloutput_prompt ("Key-in in place BOX to execute");
}
Main function will load the command table Micro Station. The next chapter we will
discuss the order form and resource file.
Micro Station command window can display the information is divided into six
areas
These six areas is wrong information domain (er-ror), prompted the domain
(prompt), the command field (command); type the domain (keyin), information field
(message), and the status field (status).
If the tcb-> control.inh_msg Set to a non-zero value, we can ban all the information sent
to these domains.
If the tcb-> cont, such as rol.inh__err set to a non-zero value, letter Number of
mdlOutput__error will not display information.
mdlOutput_ prompt
mdlOutput_ command
mdlOutput_ keyin
mdlOutput_ status
mdlOutput_ promptU
mdlOutput_ commandU
mdlOutput_ keyinU
mdlOutput_ messageU
mdlOutput_ statusU
/*----------------------------------------------------------------+
│ ELement Header structure-common to all Micro Station elements │
+ ---------------------------------------------------------------*/
typedef struct elm_hdr
{
UInt16 type; /* element type */
#if !defined (BITFIELDS_REVERSED)
UInt16 reserved:6; /* reserved for future flags - always 0 */
UInt16 archive:3; /* modified or added and not yet committed to history;
or conflict*/
UInt16 deletedCmplxHdr:1; /* deleted complex by header */
UInt16 nonModel:1; /* true if this element is file-specific and does not
belong in any model */
UInt16 locked:1; /* element is locked */
UInt16 isGraphics:1; /* element is a graphics element, has Dsp_hdr */
UInt16 isComplexHeader:1; /* is a complex header, must have number of
elements following its header */
UInt16 complex:1; /* this element is part of a complex element */
UInt16 deleted:1; /* this element is deleted */
#else
UInt16 deleted:1; /* this element is deleted */
UInt16 complex:1; /* this element is part of a complex element */
UInt16 isComplexHeader:1; /* is a complex header, must have number of
elements following its header */
UInt16 isGraphics:1; /* element is a graphics element, has Dsp_hdr */
UInt16 locked:1; /* element is locked */
UInt16 nonModel:1; /* true if this element is file-specific and does not
belong in any model */
UInt16 deletedCmplxHdr:1; /* deleted complex by header */
UInt16 archive:3; /* modified or added and not yet committed to history;
or conflict */
UInt16 reserved:6; /* reserved for future flags - always 0 */
#endif
UInt32 elementSize; /* number of words in element */
UInt32 attrOffset; /* offset (in words) from start of element to
attributes */
UInt32 level; /* element level */
ElementID uniqueId; /* unique ID of element */
double lastModified; /* last time this element was changed */
} Elm_hdr;
In order to use this structure, we must define the variable type ELm_ hdr, and use the
dot operator to access it.
hdr.level=3
Joint is a kind of allows us a relatively easy way to deal with a powerful means of data.
Consider the following elements of the joint msELementUnion. In this joint, we might add
DGNBUF written into every one within the Micro Station element. A fixed element of the
first ELm_ hdr is also within the joint.
/
*-----------------------------------------------------------------------
-------+
| name element_unio - union of all element types |
+-----------------------------------------------------------------------
--------*/
typedef union msELementUnion
{
Elm_hdr ehdr;
Header hdr; /* NOTE: hdr.dhdr is not valid unless ehdr.isGraphics is set
*/
Cell_2d cell_2d;
Cell_3d cell_3d;
Line_2d line_2d;
Line_3d line_3d;
Line_String_2d line_string_2d;
Line_String_3d line_string_3d;
Text_node_2d text_node_2d;
Text_node_3d text_node_3d;
Complex_string complex_string;
Ellipse_2d ellipse_2d;
Ellipse_3d ellipse_3d;
Arc_2d arc_2d;
Arc_3d arc_3d;
Text_2d text_2d;
Text_3d text_3d;
Point_string_2d point_string_2d;
Point_string_3d point_string_3d;
Cone_3d cone_3d;
Surface surf;
Bspline_pole_2d bspline_pole_2d;
Bspline_pole_3d bspline_pole_3d;
Bspline_curve bspline_curve;
Bspline_surface bspline_surface;
Bspline_weight bspline_weight;
Bspline_knot bspline_knot;
Bsurf_boundary bsurf_boundary;
Raster_hdr raster_hdr;
Raster _comp raster_comp;
ApplicationElm applicationElm;
ColorTable colorTable;
ReferenceFileElm referenceFileElm;
Int16 t mp[MAX_ELEMENT_WORDS];
Int16 buf[MAX_INTERNAL_ELEM_WORDS];
} MSELementUnion, MSELement;
In this way, we can define MSELementUnion types of variables el:
MSELementUnion el;
When we read one element, we can not determine what elements. The use of
elements of the joint, we can test the elements of a fixed head el.ehdr. In the example
below, we can examine a line element, the use of joint that we can access el.line_2d in
the same data.
if(el.ehdr.type=LINE_ELM
{
el.Line_2d.start.x +=100;
el.Line_2d.start.y +=100;
}
Please note that we are a joint member how to use to extract data from the joint, and
use another member to operate information. In this example, we have made a 2D line
from the right move to move 100 units 100 units.
1.4 pointers
In the MDL pointer in the right understanding of many errors that may arise. And
the use of variables, we can use int, float, double and char to illustrate the pointer.
Consider the MDL in the ordinary usage of the pointer.
Note: The parameter table * PString the definition of variables, in this book, we have to
use the ANSI method parameter list defines the type of argument, this method has the
advantages of checking the type argument.
In the above example, we see two characters pointers * pString and * pResult. An
asterisk (*) tell the program to store the pointer pString within the memory address to
find the string value.
There are two ways to pass parameters, namely, passed by value and passed by
reference. When we come to passing parameters by reference, we give the address of
variables to receive parameters. Therefore, the argument is called the program to
change the call to any change in the value of program variables, because both share the
same memory address. We have to pass a string by reference. We can address by
using a pointer pointing to a string to achieve a string of passes, when a string is aAn
array of characters when we do not need to use &, and MDL are used in all references
to pass an array.
For example, the note tells us that the string must be treated as a pointer to it passed to
the parselnputstring。
mdlResource_OpenFile(&rfHandle,NULL,FALSE);
We can also pass variables by value. Means that this variable has been assigned
the same time, this value is copied to the receiver parameters. Is called the program
variables change is local. When the program is the end of its value will be lost. See the
following examples, the process should be placed in view, a 2-arc. Which, viewNumber
passed by value. Whether we have done right to receive parameters, when we complete
the call, the variable is not changed.
..
vieWNumber=2;
placeArcbyCenter(viewNumber)
.
.
Private void placeArcbyCenter (int view)
{
MSELementUnion arc;
Dpoint3d arcp[3];
double origin;
arcp[0].x=25.; /*start point*/
arcp[0].y=35.;
arcp[0].Z=fc_zero; /*floating point constant*/
arcp[1].X=55.; /*center point*/
arcp[1].y=35.;
arcp[1].Z=fc_zero; /*floating point constant*/
arcp[2].X=85.; /*end point*/
arcp[2].y=35.;
arcp[2].Z=fc_zero; /*floating point constant*/
origin=55.0;
if(mdlArc_createByCenter(&arc,Null,arcpt,True,origin,view)==success)
{
mdlELement_display(&arc,NORMALDRAW);
mdlELement_add(&arc);
}
}
Note: MDL array of in line with C language conventions, from 0. For example, in the
above definition of Dpoint3darcP [3], the array subscript is arcp [0], arcp [1], and arcp [2].
Function pointer
In the MDL, we can put the address of the function as an argument to pass.
Therefore, the program can reference the value of a pointer to call this function
Micro Station is a event-driven machine. That is, at any point, an incident Micro
Station into a given state, and a state of the handler to process its input. We can call to
place online orders and PLACELINE the first demonstration of a point. When we move
the cursor, the second point, like pulling a rubber band, like moving across the screen,
we will choose WINDOWAREA the command and select the new window, rather than
the second given data points. In the Windows update, this line have been eliminated? As
a state machine, Micro Station command state can be distinguished. View the
command-line commands and put a different state. Therefore, we can assume that this
line is still active, press reset button so that we exit the view command and returns to
place the command line.
Figure 1.2 Micro Station input process
We can write an MDL program to deal with the establishment of a state function or type
of information, such as data points such as input information. In this way we can enter
the Micro Station basic (primitive) level. We write any of MDL applications, there will be
more convenient, and does not require additional programming.
Micro Station programming other tools, such as the UCM and MicroCSL, is to line up
Micro Station commands. By Figure 1. 3 we can see, UCM, and MicroCSL in the input
queue, task distribution, and circulation between the external applications. Therefore, the
state ordered the distribution layer applications will be out of control.
1.6 Resources
Resource is a group called the resource file being stored in the data. A typical
data set is a string, an error message, raster icons and order form. The use of resources
purpose of the paper is to separate the data and application source code. Using this
method has many advantages:
To reduce the overall memory requirements, because only the data required for the
installation.
Multiple applications can share the same resource.
Easy maintenance. Tips and information on the changes without changes to the
application. Example, you can integrate applications into other languages, such as
French.
In later chapters, we will discuss the resources and the generation method.
Bottom of the main program from the resource file to install the application
command table. Command table defines a command language. For exercise, we
assume that the main will command PLACEBOX into Micro Station. In later chapters, we
would also like to discuss the order form.
main ()
{
RscFileHandle rfHandle;
if(mdlParse_loadcommandTable(NULL)=NULL)
mdloutput_error(“Unable to load command table.”);
mdlResource_openFile(&rfHandle,NULL,FALSE);
mdloutput_prompt(“key-in PLACE BOX to execute”);
}
Here we tell Micro Station, our application order merely exist, we do not have
enforcement procedures. This is the strength of the MDL. It allows application
developers to enter the Micro Station "basic" level. We now define a group called
PLACEBOX the basic commands.
In order to activate our MDL process, we should uStn> prompt, type PLACE BOX.
Microsration a word by word analysis of our typing. Therefore, only type PLACE will
have a vague command. Micro Station can not distinguish it PLACELINE. Generate a
named PLACEBOX basic commands will not be able to use the command table,
because the command is not level, so that the command can not be classified.
Command category is very important, it allows Micro Station decisions or the allocation
of the current state of the application. In our application to generate the command
PLACEBOX table, we need to discuss this issue in detail.
When the Micro Station successfully analyze the user's typed message, it generates an
order number. An application with the command the task of linking the ID and the
command ID is used to determine the application of the implementation of this command
and call this function. In the following program, cmdNumber to function placeBox_start
and a command number combination. When we type PLACEBOX time, MDL began
PlaceBox_ start implementation.
cmdName placeBOX_start()
cmdNUmber CMD_PLACE_BOX
{
mdlstate_startPrimitive(placeBox_firstpoint,placeBox_start,1,2);
}
Program mdlState_startPrimitive state function will be established in order to use a data
point to activate PLaceBOx_firstpoint, a rest will loop implementation placeBOx_start. At
the same time, it will generate information form number from 0 to 1, information, and it
appears in the command field, while the No. 2 information displayed in the prompt field.
In the second chapter we will discuss the interest rate table and its generation method.
1. Basic commands used to generate, modify and delete elements. Start a basic
command will terminate on the one basic commands, and the basic commands in
another one to replace it until the order has been in active. Start a basic command must
be called about the command:
mdlstate_ startPrimitive Start a only basic commands used to generate the
elements
mdlstate_ startModifyCommand Start one for the place and modify the elements of
basic commands
mdlState_ startDefaultCommand。
The rest of the state control function is as follows:
mdlState_ setKeyinPrompt Provisions of the string for the type area, the default
value is "nSTN>"
The following is a list of user functions: Note: The function name in italics is not a
function of the real name. Please use your program to use the function name you use to
replace them.
Back to look at our PLBOX example, we need to build the basic commands to place the
box. When the user send data points, the first parameter placeBox-firstPoint is to
perform the function pointer. The second parameter is called when a user enters reset
function. In this case, we start recycling and re-placed the box of the basic commands.
The final two parameters used to define the information on the screen. We will discuss
the information table in the second chapter.
cmdName placeBOx()
cmdNUmber CMD_ PLACE_ BOX
{
mdlOutput_rscprintf(MSG_RPOMPT,NULL.0,2)
mdlState_StartPrimitive(P1aceBOX_firStPoint,placeBOX_start,1,2);
}
Event Type Let's look at the function placeBox-firstPoint, it needs to
mdlState_startPrimitive coming from a data point. According to information received from
the user, we will store the point and the establishment of the state function to be called.
Function mdlState-setFunction need two variables. The first is the type of event, and the
second one is to perform the function pointer. Event types possible values are:
MDL provides the elements to provide a dynamic operation. When the element
generation, movement and change can be seen on the screen display of the same
rubber band. We need a single element in the dynamic display using a simple dynamic.
Complex dynamic is used to display more than one element. mdlState_dynamicUpdate
is used for simple and dynamic functions.
Should pay special attention to the function generatelmage, because it is every time we
move the cursor when the procedure is called. In the downlink, we tell the MDL in a
dynamic operation, use this function.
mdlState_setFunction(STATE_COMPLEX_DYNANICS.generatelmage)
generate lmage will be placed on this string and a box, and to build the line and the box
in a corner alignment.
mdlElement_undoableDelete delete a
With the UNDO command to restore elements of
To use these functions generate the elements, the encoding and the
subsequent separation of the elements of the format change is a good work habits. For
the two Micro Station New - size and multi-line, which is clear, <mselems. h> elements
of the structure is not detailed.
Generating function of the elements listed below:
mdlArc_ create an arc element is generated
mdlArc_ createByCenter through the center and two endpoints generate an arc
mdlArc_ createByPoint generate an arc by 3 points
mdlCell_ create the first element of generating units
mdlCircle_ createBy3Pts generated using 3-point circle, oval
mdlCone_create generate a cone element
mdlCone_createRightCylinder generate a positive cylindrical element
mdlCone_create generate a curve element
mdlEllipse_create generate an elliptical element
mdlLine_create generate a line element
mdlLineString_create generate a line string, outline or curve elements
mdlPointString_create generate a point string element
mdlText_create generate a text element
mdlTextNode_create generates a text node elements
We will use mdlText_create generated string. Our approach is not generating any
particular string, but is displayed, the need to consider the use of dynamic display.
Graphical
When we use mdlELement_display displayed on the screen one element may be
drawing method is:
Graphical implications
This dynamic program temporary plotted on the screen of our images, and when we
move the cursor when you erase it. When we take
Closed the second location of the point, the function placeBox-secondpoint be activated,
because this state has been established previously State
privatevoid placeBox_secondpoint
(
Dpoint3d*pt
int view
)
{
generatelmage(pt,view,NORMALDRAW);
}
Function placeBox_ Secondpoint direct calls generatelmage, and passes to it a
ORMALDRAW option. We will use PLBOX elements generates an isolated unit. Call
Mdlcell_begin will generate the type 2 unit head. Since then placed on each element will
be a part of this module. In generate mage, we can see that NORMALDRAW elements
will be added to DGN document.
We should mdlText_ extractShape be rectangular 5-point (the first point and last point
coincide). The fourth variable is set to TRUE, in accordance with the current precision to
enable the border to capture a greater extent (and SETLOCATE of typing the same). We
do not read from the DGN file string because it's an operation to make DGNBUF already
have this string.
Once the calculation of a new endpoint, we can use mdlLine_create to place this line. By
calling mdlCell_end to close the unit, it uses descriptors to form the elements of number
and the correct file pointer changes to unit head
+-----------------------------------------------------------------------
----+
| Example MDL function to place a box around |
| a text string with a leader line. |
+-----------------------------------------------------------------------
---*/
/
*-----------------------------------------------------------------------
---+
| Include Files |
+-----------------------------------------------------------------------
---*/
#include <cmdlist.h>
#include <toolsubs.h>
#include <string.h>
#include <msrsrc.fdf>
#include <msparse.fdf>
#include <msoutput.fdf>
#include <mselemen.fdf>
#include <msvar.fdf>
#include <msstate.fdf>
#include <mssystem.fdf>
#include <msdialog.fdf>
#include <mscell.fdf>
#include <mselmdsc.fdf>
#include "PlaceBox.h"
#include "PlaceBoxcmd.h"
static char textin [128];
Dpoint3d pntP[2];
/
*-----------------------------------------------------------------------
---+
| name generateImage – dynamic function for box. |
+-----------------------------------------------------------------------
---*/
Private int generateImage
(
Dpoint3d*pt,
int view,
int drawMode
)
{
MSElementUnion el;
Dpoint3d origin;
Dpoint3d shapeP[5];
MSElementDescr * pDescr = NULL;
pntP[1]=origin=*pt;
mdlCell_create (&el, "BOX", &pntP[0], FALSE);
mdlElmdscr_new (&pDescr,NULL,&el);
/*create Text in dgnBuf for Micro Station Dymamics to display */
mdlText_create (&el,NULL,textin,&pntP[1],NULL,NULL,NULL,NULL);
mdlElement_display(&el,drawMode);
mdlElmdscr_appendElement(pDescr,&el);
mdlText_extractShape(shapeP,NULL,&el,TRUE,view);
mdlShape_create(&el, NULL, shapeP, 5, -1);
mdlElement_display(&el, drawMode);
mdlElmdscr_appendElement(pDescr,&el);
if (pntP[0].x < origin.x)
{
if (pntP[0].y < origin.y)
{
pntP [1] .x=shapeP [0] .x;
pntP[ 1] .y=shapeP[0] .y;
} else {
pntP[1] .x=shapeP [3].x;
pntP [1] .y=shapeP [3].y;
}
}else {
if (pntP[0].y < origin.y)
{
pntP[1] .x=shapeP[1] .x;
pntP[1].y=shapeP[1].y;
} else {
pntP[1] .x=shapeP[2] .x;
pntP [1] .y=shapeP[2] .y;
}
}
/* Place the modified leader line */
mdlLine_create(&el, NULL, pntP);
mdlElement_display (&el, drawMode);
mdlElmdscr_appendElement(pDescr,&el);
if (drawMode==NORMALDRAW)
{
mdlElmdscr_add(pDescr);
}
mdlElmdscr_freeAll(&pDescr);
return SUCCESS;
}
/
*-----------------------------------------------------------------------
---+
| name keyinText |
+-----------------------------------------------------------------------
---*/
Private void keyinText(char *cmdStringP)
{
strcpy(textin,cmdStringP);
}
/
*-----------------------------------------------------------------------
---+
| name placeBox_done |
+-----------------------------------------------------------------------
---*/
Private void placeBox_done()
{
mdlOutput_rscPrintf(MSG_PROMPT,NULL,0,4);
mdlState_restartCurrentCommand();
}
/
*-----------------------------------------------------------------------
---+
| name placeBox_seconPoint |
+-----------------------------------------------------------------------
---*/
Private void placeBox_secondpoint
(
Dpoint3d *pt,
int view
)
{
generateImage(pt,view,NORMALDRAW);
}
/
*-----------------------------------------------------------------------
---+
| name placeBox_firstPoint |
+-----------------------------------------------------------------------
---*/
Private void placeBox_firstpoint
(
Dpoint3d*pt,
int view
)
{
pntP[0]=*pt;
/*Set the datapoint state function for the second point.*/
mdlState_setKeyinPrompt ("KEY IN TEXT:");
mdlState_setFunction (STATE_KEYIN,keyinText);
mdlState_setFunction (STATE_DATAPOINT,placeBox_secondpoint);
mdlState_setFunction (STATE_RESET,placeBox_done);
mdlOutput_rscPrintf (MSG_PROMPT,NULL,0,3);
/*Setup Rubber Banding function*/
mdlState_setFunction (STATE_COMPLEX_DYNAMICS,generateImage);
}
/
*-----------------------------------------------------------------------
---+
| name placeBox_start |
+-----------------------------------------------------------------------
---*/
void placeBox_start()
cmdNumber CMD_PLACE_BOX
{
mdlState_startPrimitive(placeBox_firstpoint,placeBox_start,1,2);
}
/
*-----------------------------------------------------------------------
----------**//**
* @description PlaceBox_unloadFunction
* @param unloadType Reason for the unload of the app
* @return SUCCESS to allow the unload; ERROR to disallow the unload
* @bsimethod BSI 06/03
+---------------+---------------+---------------+---------------
+---------------+------*/
Private int PlaceBox_unloadFunction
(
int unloadType
)
{
BoolInt disallow = FALSE;
/*------------------------------------------------------------------
| If the value of unloadType is negative, then Micro Station ignores
| the return value of this function. In this case, we can assume
| that Micro Station is shutting down or was terminated so this
| function should not attempt to abort the unload.
+------------------------------------------------------------------*/
if (unloadType < 0)
{
return FALSE;
}
/*
** Your processing, which may include setting the disallow flag to TRUE
*/
return (disallow ? ERROR : SUCCESS);
}
/
*-----------------------------------------------------------------------
----------**//**
* Dialog/Item Hooks; Command Numbers and Command Names
+---------------+---------------+---------------+---------------
+----------------*/