#NEWLINE# def getMarkerJSON( self ) : #NEWLINE# #INDENT# markerJSON = StringIO ( ) #NEWLINE# for ( i , marker ) in enumerate ( self . _markers ) : #NEWLINE# #INDENT# markerJSON . write ( '{"mid":"' ) #NEWLINE# markerJSON . write ( str ( marker . getId ( ) ) ) #NEWLINE# markerJSON . write ( '","lat":' ) #NEWLINE# markerJSON . write ( str ( marker . getLatLng ( ) [ 1 ] ) ) #NEWLINE# markerJSON . write ( ',"lng":' ) #NEWLINE# markerJSON . write ( str ( marker . getLatLng ( ) [ 0 ] ) ) #NEWLINE# markerJSON . write ( ',"title":"' ) #NEWLINE# markerJSON . write ( marker . getTitle ( ) . replace ( "'" , "\\'" ) . replace ( '"' , '\\\\"' ) ) #NEWLINE# markerJSON . write ( '","visible":' ) #NEWLINE# markerJSON . write ( ( 'true' if marker . isVisible ( ) else 'false' ) ) #NEWLINE# markerJSON . write ( ',"info":' ) #NEWLINE# markerJSON . write ( ( 'true' if ( marker . getInfoWindowContent ( ) is not None ) else 'false' ) ) #NEWLINE# markerJSON . write ( ',"draggable":' ) #NEWLINE# markerJSON . write ( ( 'true' if marker . isDraggable ( ) else 'false' ) ) #NEWLINE# if ( marker . getIconUrl ( ) is not None ) : #NEWLINE# #INDENT# markerJSON . write ( ',"icon":"' ) #NEWLINE# markerJSON . write ( ( marker . getIconUrl ( ) + '"' ) ) #NEWLINE# if ( marker . getIconAnchor ( ) is not None ) : #NEWLINE# #INDENT# markerJSON . write ( ',"iconAnchorX":' ) #NEWLINE# markerJSON . write ( str ( marker . getIconAnchor ( ) [ 0 ] ) ) #NEWLINE# markerJSON . write ( ',"iconAnchorY":' ) #NEWLINE# markerJSON . write ( str ( marker . getIconAnchor ( ) [ 1 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# markerJSON . write ( ',"iconAnchorX":' ) #NEWLINE# markerJSON . write ( str ( marker . getLatLng ( ) [ 0 ] ) ) #NEWLINE# markerJSON . write ( ',"iconAnchorY":' ) #NEWLINE# markerJSON . write ( str ( marker . getLatLng ( ) [ 1 ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# markerJSON . write ( '}' ) #NEWLINE# if ( i != ( len ( self . _markers ) - 1 ) ) : #NEWLINE# #INDENT# markerJSON . write ( ',' ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# json = ( ( '[' + markerJSON . getvalue ( ) ) + ']' ) . encode ( 'utf-8' ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# json = ( ( '[' + markerJSON . getvalue ( ) ) + ']' ) . encode ( ) #NEWLINE# #UNINDENT# markerJSON . close ( ) #NEWLINE# return markerJSON