Comments (5)
Could you provide an example use case?
What kind of "items" would you want to add/change?
Can you provide a map and data that would use it? (modify your local version of
geoxml3 with your proposed change and show it in action)
I would think if this was implemented, there should be similar callbacks for
polylines and polygons.
Original comment by geocodezip
on 28 Sep 2011 at 11:53
- Added labels: Type-Enhancement, Priority-Low
- Removed labels: Type-Defect, Priority-Medium
from geoxml3.
Original comment by geocodezip
on 28 Sep 2011 at 11:53
from geoxml3.
Thanks for the response:
Use case:
I want to create my own listeners for the marker, in order to better manage
the infowindow mobile devices (particularly webkit browsers which by and
large don't manage embedded objects like youtube videos very well). I also
want to add my own attribute to the marker (to set a timeout option in this
particular case).
Yes, it is likely that polys need the same callback feature, although I
would make them separate callbacks.
the geoxml modification (*bold*) to createMarker() function:
*if (!!parserOptions.pmParseMk) parserOptions.pmParseMk(marker, placemark);
**
* // Infowindow-opening event handler
google.maps.event.addListener(marker, 'click', function() {
this.infoWindow.close();
marker.infoWindow.setOptions(infoWindowOptions);
this.infoWindow.open(this.map, this);
});
then in my js file, as part of the specification of the options passed to
geoXML3.parser(options):
pmParseMk: (function addMarkerAttr (marker, placemark) {
marker.waitTime = placemark.waitTime;
google.maps.event.addListener(marker, 'click', function() {
removeVideoFloatElement();
this.infoWindow.timeLeft = marker.waitTime;
});
google.maps.event.addListener(marker.infoWindow, 'closeclick',
function() {
removeVideoFloatElement();
});
})
I'm a little concerned about the two listeners for the same events (mine and
geoxml's), but it seems to work OK, at least for the current versions of the
API's.
JB
Original comment by [email protected]
on 29 Sep 2011 at 1:17
from geoxml3.
My approach is to pass a custom createMarker function as the createMarker
option to the geoXML3.parser call:
function (placemark, document) {
document.markers = document.markers || [];
var found = false;
if (document.reload) {
for (var j = 0; j < document.markers.length; j++) {
if (document.markers[j].getPosition().equals(placemark.latlng)) {
found = document.markers[j].active = true;
break;
}
}
}
if (!found) {
var marker = kmlParser.createMarker(placemark, document);
marker.active = true;
google.maps.event.addListener(marker, "click", function () { ... do something ... });
}
}
My own createMarker function calls the built-in createMarker function, and then
adds the listener. It works fine, as far as I can see.
The down side is that I had to duplicate some of the code in the render
function to make it work. For example, if I leave out the
document.markers = document.markers || [];
line, the built-in createMarker function no longer works. Ideally, I think, my
function would have read like this:
var marker = kmlParser.createMarker(placemark, document);
google.maps.event.addListener(marker, "click", function () { ... do something ... });
Original comment by [email protected]
on 21 Dec 2011 at 1:33
from geoxml3.
And a question about this part:
if (doc.markers[j].getPosition().equals(placemark.latlng)) {
found = doc.markers[j].active = true;
Are two markers identical if they have the same latlng position? What if I have
two markers at the same position? What if an update to a previously loaded kml
document has a marker with an unchanged position, but a change in the name, or
description? If I understand the code correctly, these changes would be ignored?
Original comment by [email protected]
on 21 Dec 2011 at 1:38
from geoxml3.
Related Issues (20)
- docs array, first element gets clobbered on each parse. Does not save one doc per Array element HOT 5
- failedParse callback not being called HOT 7
- Uncaught InvalidStateError: Failed to execute 'overrideMimeType' on 'XMLHttpRequest': MimeType cannot be overridden when the state is LOADING or DONE. HOT 4
- Placemarkers not visible HOT 3
- No marker property available in afterParse HOT 3
- Parsing does not support namespace HOT 3
- Points moved in new egeoxml.js version HOT 3
- kmz branch r123 - sort geo.docs alphabetically by url HOT 2
- Firefox - Can't find icons.png files HOT 1
- docs.indexes not loaded until function calling geo.parse finish
- Poor performance because of incorrect render() logic HOT 9
- Map doesn't show the KML information anymore the from the second time and so on.
- Icon size too large
- Uncaught TypeError: geoXml.docs[0].gpolygons[i].Contains is not a function HOT 1
- documentation on how to create a custom click
- Asian properties not included after KML parser completes
- Oracle Apex Integration
- fetchDoc() determines file type based on URL instead of actual content type
- geoXML3.fetchXML does not include cookies / credentials HOT 1
- kmlLayerData.docs[0].gpolygons[0].Contains is not a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoxml3.