Autodesk 15606-011408-9300 Developer Guide - Page 176
var sdfToolKit = Server.CreateObjectAutodesk.MgSdfToolkit.1, poi.asp, continued
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 176 highlights
poi.asp Example Code (continued) // Now, use the SDF Component Toolkit commands to drive the controls. // This code is all wrapped within an if statement that verifies // whether a valid command (add, find, or remove) has been issued // before it creates an instance of the SDF Component Toolkit. if (op == "Add" || op == "Find" || op == "Remove") { pointName = Request.Form("pointName"); if (pointName Create an instance of the SDF Component Toolkit var sdfToolKit = Server.CreateObject("Autodesk.MgSdfToolkit.1"); // If the command is Add or Remove, open the SDF for read/write. // If the command is Find, open the SDF as read-only. if (op == "Add" || op == "Remove") { //Use the constants "32 | 2" to indicate sdfOpenUpdate and //sdfOpenExisting. These constants open for read/write and //report errors if the file doesn't exist. sdfToolKit.Open("c:\\sdf\\poi.sdf", 32 | 2, true); if (op == "Add") //add the point { pointLat = parseFloat(Request.Form("pointLat")); pointLon = parseFloat(Request.Form("pointLon")); // Set up the variables for building the point. A point // in the SDF Component Toolkit follows the object // hierarchy (in shorthand) of // object.geometry.segment.point. // Proceed only if the lat and lon values are valid. if (!isNaN(pointLat) && !isNaN(pointLon)) { var sdfObject = Server.CreateObject("Autodesk.MgSdfObject.1"); var sdfGeometry = Server.CreateObject("Autodesk.MgSdfObjectGeometry.1"); var sdfSegment = Server.CreateObject("Autodesk.MgSdfObjectGeometrySegment.1"); var sdfPoint = Server.CreateObject("Autodesk.MgSdfDoublePoint.1"); // Now build the point into an SDF object. Use the text // in the Name field for both the name and the key; // leave the URL empty. sdfPoint.SetCoordinates(pointLat, pointLon); sdfSegment.Add(sdfPoint); sdfGeometry.Add(sdfSegment); 176 | Chapter 7 Applications