Embodiment
The method that a kind of SVG of utilization demonstration projection device of the present invention carries out demonstration projection is to pass through script, call DOM function and SVG DOM function, response DOM incident, the SVG dom tree of treatment S VG data file correspondence in application program, the control projector represents the demonstration effect of various complexity.Described script mainly refers to ECMAScript, also other script that can be supported by SVG.Described method logically is divided into system three layers: application layer, logical layer and data Layer.
To be SVGViewer read in dom tree that internal memory creates with the SVG document to described data Layer and finished to be stored in the id that creates in dom tree with the SVG script be the node content of " window " by logical layer, and all these contents are referred to as data memory module.Described application layer mainly is responsible for the reception of incident, and the respective modules that the incident that receives is distributed to logical layer, the incident that it can receive comprises the onload incident that triggers when document loads, mouse event (as onclick/onmouseup), KeyEvent (as onkeyup/onkeydown).Described logical layer is a SVG demonstration projection device of the present invention place layer, this SVG demonstration projection device is finished the response action of variety of event, carry out data interaction with data Layer, show various complicated demonstration effects, referring to Fig. 1, its formation comprises that mainly animation is shown module and broadcast state administration module in projection page data preparation module, page or leaf handover module, the page or leaf, and it can also comprise the index page processing module.
The operating mechanism of total system is a case mechanism, and the reception of customer incident depends on the mouse event support that DOM provides on the one hand, depends on the KeyEvent support that Adobe SVGViewer provides on the other hand.Its treatment scheme is as follows:
Referring to Fig. 1 to Fig. 4, when the SVG demonstration data file was loaded, the onload incident of utilizing DOM to provide was called its response function, called the interface that projection page data preparation module provides in response function, prepared the projection page data.If specified the custom show list name, then read the content of specifying the custom show tabulation, otherwise, with the definition of order of Slide as the custom show list content, again by the static data preparation module in the projection page data preparation module, according to list content, obtain and specify the Slide raw data, and according to a special identifier in this Slide raw data, judge itself and the incidence relation of corresponding Master, in internal memory with Master data and Slide raw data rule according to appointment, the synthetic static data that can directly be shown by the SVG player, and the data after will synthesizing are appended to the id that created by the SVG script in the dom tree successively in " window " node.Described projection page data, its data set composition two parts, static SVG data and animation SVG data, static data must be prepared fully and can directly be shown by the SVG player, and animation data promptly can be disposable ready, also can progressively add in the later stage.Described rule refers to: if incidence relation represents to ignore the background graphics of mother matrix, then Slide and Master related changed into quoting the Master background color, otherwise, copy is all Shape Shape definition position before behind the connective marker of Slide in the mother matrix, and connective marker changed into ignores mother matrix.At last, if there is the module that loads animation data, then also need use " function animation " method that animation data is ready to.Its principle of following is: when loading the page or leaf animation data of Slide, when specifying Slide not have page animation data, can attempt loading the page or leaf switch data of corresponding Master, and in the loaded page during animation data, at first judge the incidence relation of current Slide and Master, if current Slide has ignored the background graphics of corresponding mother matrix, then only need utilize " function animation " to load according to the animation tabulation of current page, otherwise, in loaded page, before the animation data of Shape, get the animation data that loads Shape among the corresponding Mater earlier.
After the projection page data is ready to complete, application layer receives various mouses, KeyEvent, and transfer incident to specific action, call the corresponding function interface that the broadcast state administration module provides, call which functional module realizing its functional requirement by the broadcast state administration module according to type of action and the decision of current system projection state again, and the current system of real-time update projection state.Referring to Fig. 3, the broadcast state administration module is one page, page up, relatively simple when jumping to page or leaf change action such as specific page under handling, and only need be converted into to the calling of page or leaf handover module, for it provides key message, finish when the page or leaf handover module calls, revise the state value of current page call number.If next action or last is moved, also need to judge the interior animation broadcast state of page or leaf of current page, decision is called page handover module and is still called a page interior animation projection module again.If the page or leaf handover module disposable not ready animation data in projection page data preparation module, then also needs to prepare earlier animation data herein except finishing normal switchings page or leaf function, the method for loading animation data as previously mentioned.
Except that some above-mentioned indispensable modules with the basic function of finishing projection system, for the function that makes this projection system is more powerful, the following enlargement module can also be arranged:
Version verification and Version Control module, be used for not carrying out respective handling simultaneously when documentation release and projector version, so that during version (comprising versions of data and projector version) upgrading from now on, can backward compatible even two-way compatibility, if there is this module, then the startup of this module should be prior to aforesaid arbitrary module;
Automatically the projection module is finished exhibition booth playing function in the demonstration, and at any one time, can be switched to mutual projection state by automatic projection state.
The navigation bar module, the function button of can be integrated as required on this tool bar having realized arbitrarily is as functional entrance, and is user-friendly.
Below in conjunction with accompanying drawing and example SVG demonstration projection method of the present invention is described:
As shown in Figure 1, the operation of whole projection system all is that case mechanism by DOM triggers.When the SVG demonstration data file is loaded, trigger the onload incident, when application layer listens to this incident, by calling its response function, also promptly show the page data preparation module and be the interface that application layer provides, begin to prepare the projection page data, as the inlet of treatment S VG document.The structural drawing of described projection page data preparation module as shown in Figure 2, must comprise the static data preparation module, can also comprise animation data preparation module in page animation data preparation module and the page or leaf, but these two submodules are optional, they also can all or part ofly be included in the page or leaf handover module described later, can also comprise the Version Control module, when being convenient to upgrade afterwards, make things convenient for edition compatibility.If there is the submodule of two back, the static data preparation module must be called at first, and then call other submodule, and this module provides one to handle when reloading the interface that presentation content is used to application layer being used to of calling.The function that this module is mainly finished is the initialization presentation data, and the data of original internal memory dom tree are synthesized played data according to the principle of appointment.Wherein the main task finished of static data preparation module is to obtain the version information of current document, if the version of the document that will handle and the version of projector are not inconsistent, then log off, do not carry out any operation, otherwise read the content of specifying the custom show list name, one by one Master data and Slide data are synthesized according to list content, generate the projection page data, be exemplified below:
The content of supposing the custom show tabulation leaves in the gSlideElementList array.At first, from this array, read a value, duplicating corresponding Slide data according to this value from lantern slide page data definition is SlideCopy, and regenerate the id of SlideCopy, and supposing that the id of former Slide is " oldId ", the id of the Master related with it is " mastered ", the id of then newly-generated SlideCopy be " oldId "+.? (? unduplicated integer word in expression the document, since 0, increase progressively successively), as " oldId.0 ";
Then, use the DOM function to obtain that id value is the element of " oldId.master " among the SlideCopy, the effect of the pairing element of this id is to set up related for Slide with Master, point out whether this Slide ignores the background graphics among the corresponding Master, for convenience of description, associated element is called for short in the back.If the xlink:href property value of this associated element is " masterId ", then the background graphics among the Master is not ignored in expression, is else if " masterId.background ", and then expression is ignored.When ignoring, change the id of this associated element into " oldId.master.ignoreshapes ", otherwise, change its id into " masterId.background ", and shapes all among the masterId is copied among the SlideCopy.It should be noted that, the hierarchical relationship of each Shape is by their sequencing decisions when the data definition, so for after the shapes among the Master is copied to SlideCopy, can not cause the Shape among the Shape covering SlideCopy among the Master, Shapes among the Master must be copied to associated element among the SlideCopy after, before all Shapes definition, the insertBefore interface that this operation can utilize DOM to provide is finished.
At last, the SlideCopy that generates is appended to an id value of using script to create is in the node of " window " in the internal memory dom tree, this node screening zone that is otherwise known as.
According to the method described above, values all in the gSlideElementList array is all processed intact by vertical order, and so far, the static data of the projection that is useful on is ready.
If realized animation data preparation module in page or leaf animation data preparation module or the page or leaf in the projection page data preparation module, can also be that static data loads animation data then by these two modules, finish the preliminary work of projection page data.In the SVG demonstration data file, the expression of animation data is what to adopt with the formal representation of the XML of SVG compatibility, and by the animation data that the XML data can directly be handled to the SVG player, this process is finished by " function animation " method.Wherein the switching animation loading principle of Slide is if the Slide animation data when not having, can remove to attempt loading the page or leaf switch data of corresponding Master.The loading principle of animation is if do not ignore background graphics in the mother matrix in the page or leaf, then at first loads the animation data of the Shape of corresponding mother matrix, reloads the animation data of the Shape in the Slide.
The treatable action of broadcast state administration module has five kinds: a last action, and next action, page up, following one page jumps to specific page.When having action to take place, at first analyze type of action, again according to type of action, call corresponding processing module, and the current broadcast state of real-time update, the relation of it and other module cooperating as shown in Figure 3, after the broadcast state administration module is to action by analysis, if action relates to the page or leaf switching, the broadcast state administration module then can call the internal interface that page handover module provides, notice page or leaf handover module is handled the action that takes place, and for the page or leaf handover module provides key message, so that allow page handover module can accurately handle corresponding action.Described page or leaf handover module as shown in Figure 2, preceding page module and back page module are indispensable modules, finish the function that switches to down one page and switch to page up respectively, page or leaf animation data preparation module is prepared to decide on projection page data preparation module with the interior animation data of page or leaf, if projection page data preparation module has comprised these two modules or one of them, then involved module can not be as the submodule of page or leaf handover module, does not have the involved module must be as the submodule of this module.After the internal interface of page or leaf handover module is called, the page or leaf handover module is activated, the information that it can provide the broadcast state administration module is immediately judged, if jump to specific page, then at first finds the page or leaf of specific page to switch animation, hide current page then, show specific page, and activate page or leaf switching animation, simultaneously, the broadcast state administration module upgrades current page number synchronously, finishes a page redirect.If jump to down one page or page up, the method of skipping is with to jump to specific page identical, but to consider also whether the redirect page or leaf is hiding, its concrete treatment scheme as shown in Figure 4, if all animation datas are loaded in projection page data preparation module, then only need to activate the page or leaf animation herein, otherwise, also need the animation of the Drawing Object in the lantern slide is carried out data preliminary work; The 2nd, as seen what utilize DOM functions control lantern slide still is invisible (display attribute), here need to control two pages show state, this show state of two pages is mutual exclusion, for " following one page ", then make current page hide (the display property value is changed to " none "), following one page shows (the display property value is changed to " inline "), for " page up ", current page is hidden, and page up shows.For convenience of description, the call number of supposing current page is C, and this index value is composed to K.If " page up " judges at first that then the K page or leaf is a homepage, if homepage, then do not carry out any action, direct process ends, otherwise the K value is from subtracting 1, judge that again the K page or leaf is hidden page (the visibility property value is " hidden "), if hidden page judges whether it once was played, if never be played again, then directly skip the K page or leaf, use same procedure to repeat an action; If not hidden page, then directly show the K page or leaf, hide the C page or leaf, it is current page, and judge whether K page or leaf animation data has been ready to, under situation about being not ready for, also need to enable the page or leaf animation data that page animation data preparation module adds the K page or leaf, activate the page or leaf animation of K page or leaf at last, the state when showing page or leaf projection for the last time.If " following one page ", judge at first that then the K page or leaf is a last page, if last page is not then carried out any action, direct process ends, otherwise, the K value judges that again the K page or leaf is a hidden page, if hidden page from adding 1, then directly skip the K page or leaf, use same procedure to continue to judge one page down; If not hidden page, then the K page or leaf is shown, the C page or leaf is hidden, be that current page is hidden, and call a page animation data preparation module, load the page or leaf animation data of K page or leaf, loading method is if Slide itself has a page animation, then directly use the page or leaf animation of K page or leaf, if the K page or leaf does not have a page animation, the animation of mother matrix that then attempt to load K page or leaf correspondence is as the page or leaf animation of K page or leaf, if the page or leaf animation is loaded in projection page data preparation module, then only need call page an interior animation function herein is that the K page or leaf is prepared a page interior animation, loading method is at first to load the animation that has all Shape of animation in the corresponding mother matrix, reload that all have the animation of the Shape of animation in the K page or leaf, if herein in the page or leaf animation data also in projection page data preparation module, be ready to, then directly start K page or leaf page or leaf animation.No matter be to jump to page up, still one page down all must upgrade current broadcast state synchronously, i.e. C=K, and making current page number is the page number of that page of being shown all the time.
If animation in the page or leaf is thought in action after the analysis of broadcast state administration module, the broadcast state administration module then can call page internal interface that interior animation projection module provides, the action that animation projection resume module takes place in the notice page or leaf, and for animation projection module in the page or leaf provides key message, so that allow a page interior animation projection module can accurately handle corresponding action.After the internal interface of animation projection module in the page or leaf is called, be activated immediately, according to the key message that receives, decision is an animation in next animation of projection or the blanking.Animation projection module as shown in Figure 2 in the described page or leaf, it comprises two modules: animation projection module and animation blanking module, be respectively applied for and handle the situation when animation also not have projection to finish in next action and the page or leaf and handle a last action and the situation of page interior animation when also not having playback to finish, when carrying out animation projection or animation playback, must be divided into animation and two kinds of the animations of following a certain animation that processing events excites.
Demonstration projection method of the present invention is by script, calls DOM function and SVG DOM function, response DOM incident, and the dom tree of treatment S VG data file correspondence in application program, the control projector represents the demonstration effect of various complexity.Because presentation data is dynamically to generate when projection, so data independence wants high more than static tissue, and dirigibility also strengthens greatly, can generate multiple projection sequence with a raw data according to different being provided with, and can utilize the good data definition structure to develop some and represent the extended function of outward appearance, make project effect outstanding such as dynamic change.
Above step is the unrestricted technical scheme of the present invention in order to explanation only.Any modification or partial replacement that does not break away from spirit and scope of the invention all should be encompassed in the middle of the claim scope of the present invention.