• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk MapGuide Developer

    Reply
    Member
    Posts: 3
    Registered: ‎02-09-2005

    Redlining a polyline

    16 Views, 0 Replies
    01-12-2006 02:36 AM
    I am trying to redline a polyline

    When I run the procedure I am getting an error message saying that there aren't the correct number of points.

    Can anybody tell me what I need to do to correct this

    function TROs_onDigitizedPolyline (map, numPoints, points)
    {

    // Create Redlining layer if it doesn't exist
    redlineLayer = map.getMapLayer("Route");
    if (redlineLayer == null) {
    map.createLayer("redline", "Route");
    redlineLayer = map.getMapLayer("Route");
    redlineLayer.setShowInLegend(false);
    }
    else {
    objects = redlineLayer.getMapObjects();
    if (objects.size() > 0){
    redlineLayer.removeObjects(objects);
    }
    }
    // check if line is continuation of a route
    if (gNumPoints > 0) {
    gNumPoints = gNumPoints + numPoints;
    for (i=0;i gPoints.add(points.item(i));
    }
    }
    else {
    gNumPoints = numPoints;
    gPoints = points;
    }
    // Get user input
    name = gMethod;
    key = parent.rightFrame.document.RedlineForm.Key.value;
    vertices = map.createObject("MGCollection");
    numVertices = map.createObject("MGCollection");
    numVertices.add(gNumPoints);
    alert("You just digitized a polyline with "+ numPoints +" points");
    // Get polyline vertices
    for (i=0;i {
    latVal = gPoints.item(i).getY();
    lonVal = gPoints.item(i).getX();
    point = map.lonLatToMcs(lonVal,latVal);
    vertices.add(point);
    }
    // Add polyline

    if (gAction == "Polyline"){
    polyline = redlineLayer.createMapObject("",name,"");
    alert("ondigitize");
    polyline.addPolylinePrimitive(vertices,numVertices,true);

    }
    // map.refresh();

    }
    Please use plain text.