Baidu provides a developer's platform with a pretty extensive documentation with examples or demo examples.

To help Drupal developers better use the module and integrate their own logic, we could write a short Javascript file, that wouldn't be used/loaded by the module, but would contain examples extracted from Baidu's demo links and Map API Documentation.

The file could demonstrate how to add or override specific Javascript logic in Drupal to interact with the Baidu Map Javascript API through the objects provided by the Baidu Map module.

Please let me know if you would have any questions, objections, comments, suggestions, recommendations or concerns on any aspects of this task, I would be glad to provide more information or explain in more details.

Any questions, feedback, testing, changes, recommendations would be highly appreciated.
Thanks to all in advance.

Comments

xiukun.zhou’s picture

Status: Active » Fixed

Quick follow-up on this task:

Added a new JavaScript file examples.js that provides a few examples based on the Baidu Map JS API, of how map objects could interact with the rest of the page DOM and specific JS logic triggered by other objects or events on the page. To use and test these examples, this file should be loaded after module's other JS files. Then, modify the map ID in the code to match with the map to be tested.

var elemID = 'geofield-baidu-map-entity-node-12-field-baidumap';

Among some of the examples:
API Services:
Example 1: Execute a local search when #header is clicked.
Example 2: Execute a local search inbounds when #page-title is clicked.

Interactions with Map, Overlay, Markers, InfoWindow and Controls:
Example 3: Removing features:

  删除一个marker. Remove a single specific feature.
  map.removeOverlay(markers[0]);
  删除所有的marker. Remove all features/clear the map.
  map.clearOverlays();

Example 4: Resetting Marker's infoWindow, 重新定义infowindow.
Example 5: map控件, Interacting with map controls.
 
I went ahead and committed the changes against the 7.x-1.x branch at 23ad4a6.
 
Feel free to let us know if you would like to share any more Javascript examples of integration between Drupal and Baidu Map, I would surely be glad to take a closer look and try adding these examples to the file.
 
I'm sure we could certainly think of adding more examples in the future, so we might certainly come back to this ticket or create new issues later on to update, add or remove Javascript code related with these examples.
 
I allowed myself to mark this issue as fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections with this issue or related commit 23ad4a6 (we would surely be happy to hear your feedback).
 
Please let me know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on the commit or this task in general, I would be glad to provide more information or explain in more details.
 
Thanks in advance to everyone for your testing, reviews, feedback and comments on this issue.
Cheers!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.