Autodesk 15606-011408-9300 Developer Guide - Page 100
Adding a Button with the Viewer API, Autodesk MapGuide to display Parcel Data CF.
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 100 highlights
Adding a Button with the Viewer API An Autodesk MapGuide report is generated by right-clicking the map and then choosing View ➤ Reports from the popup menu. This interface is not immediately apparent to users, so we'll make it easier by creating a Parcel Report button that will display the report. First we'll add the following tag to the parcel_map.htm file: function getMap() { if (navigator.appName == "Netscape") return parent.Left.document.map; else return parent.Left.window.map; } function runReport() { parent.Right.document.write("Select one or more parcels first."); getMap().viewReport('Parcel Data (CF)'); } The tag holds two JavaScript functions. The first function is getMap. The second, runReport, displays our Autodesk MapGuide report. The runReport function consists of two statements. The first statement writes a line of text to the right-hand frame of our report application. You will notice that the text instructs users to select one or more map features. This instruction displays each time runReport is invoked, regardless of whether the user has selected features. If features are selected, the instructions are replaced in the frame by the contents of the newly generated report; otherwise the instructions remain in the frame to provide feedback. Note parent refers to the top-level frame and Right is the name we specified for our right-hand frame in parcel_frames.htm. Refer to third-party JavaScript documentation for more information on writing to frames and windows. The second statement uses the viewReport method to run our report. The statement begins by calling getMap, which returns the map object in the Web page. The map object is then passed to viewReport, which directs Autodesk MapGuide to display Parcel Data (CF). Now that our function is defined, we need a way to call it, adding a element to parcel_map.htm: