     @link.setMap($a.map)
     @
 
-  # this method reads the path of points contained in the legs, joins them 
-  # into one array with no duplicates and then encodes the using googles 
+  # this method reads the path of points contained in the legs, joins them
+  # into one array with no duplicates and then encodes the using googles
   # geomtry package in order to save the path to models linkgeometry field
   _createEncodedPath: (legs) ->
     smPath = []

    lg = new $a.LinkGeometry()
    ep = new $a.EncodedPolyline()
    pts = new $a.Points()
    pts.set({text:@encodedPath})
    ep.set({points: pts})
    lg.set({encodedpolyline:ep})
    @model.set({linkgeometry: lg})

  # Creates the Polyline to rendered on the map
  # The Polyline map attribute will be null until render is called

    $a.broker.trigger("map:select_item:#{beginNode.cid}")
    $a.broker.trigger("map:select_item:#{endNode.cid}")

  # called from the context menu as well. It clears itself and its nodes as
  # well as the higlighted tree items
  clearSelfandMyNodes: () ->
    @clearSelected()
