Custom Redlining Application
|
139
The example above is a very simple application designed to illustrate
redlining. However, your application can have more features, such as
allowing users to add other primitives besides polygons. Also, you can exert
more control over how the primitives appear on screen or to query the state
of existing redline objects. To learn more about these topics, refer to the
following sections in the
Autodesk MapGuide Viewer API Help
:
■
For information about creating primitives, look up the
MGMapObject
add
methods (
addCirclePrimitive
,
addPolygonPrimitive
, and so on).
Also look up the
MGMapdigitize
methods and their corresponding
events.
■
For information about controlling the appearance of redline objects, look
up
MGEdgeAttr
,
MGFillAttr
,
MGLineAttr
,
MGSymbolAttr
,
MGTextAttr
, and
MGRedlineSetup
.
■
For information about querying redline objects, look up
MGPrimitive
.
var obj = layer.getMapObject(formText);
if (obj == null)
var obj = layer.createMapObject(formText, formText, "");
// create MGCollection that holds user-specified polygon vertices
var user_vertices = map.createObject("mgcollection");
user_vertices.add(numPoints);
// use MGCollection to create polyline primitive and add it to
// redline object
obj.addPolylinePrimitive(points, user_vertices, false);
// clear contents of 'Polygon Name' text box
document.the_form.the_textbox.value = "";
}
The Save It! button calls a JavaScript function that saves the map
to the user’s hard drive. The function prompts the user for the map
password, then calls the MGMap.saveMWF method, and saves the map to
the specified path:
function save_it()
{
var fName = "c:\\My Documents\\my_map.mwf";
var password = prompt("Please enter a password.", "");
if (getMap().saveMWF(fName, password) )
alert("Map has been saved!");
else
alert("Unable to save map.");
}
onDigitizedPolygon Function (
continued
)
Summary of Contents for 15606-011408-9300 - MAP R6.3 UPG
Page 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Page 6: ...vi ...
Page 16: ...16 ...
Page 30: ...30 ...
Page 84: ...84 ...
Page 134: ...134 ...
Page 202: ...202 ...