Is possible to get only the visible markers? Is there any function for this?
This is the function where I have the bounds:
hereMap.addEventListener('mapviewchangeend', (evt) => {
var bounds = hereMap.getViewModel().getLookAtData().bounds;
}, false);
Can you please to know what visible marker actually implies ? however if you want to limit the visibility of markers, GeoCoordinates can be specified for a bounding box and passed in mapview, that can limit the visibility of map in the view. Also you can then set the visibility of inside markers to true.
Related
(I know it will be unstable but I still want to try it)
I want to move around in aframe scene using accelerometer
AFRAME.registerComponent('acccam',{
window.addEventListener('devicemotion', function(){
var acc = event.acceleration;
this.el.object3D.position.x += acc.x*9.8;
this.el.object3D.position.y += acc.y*9.8;
this.el.object3D.position.z += acc.z*9.8;
}, true);
})
I expect the camera to move or at least shake/something but nothing is happening could getelement by id, get attribute and set attribute be used to update the position by taking temporary values and then cloning them if yes then how?
Make sure the event is firing, and make sure you don't have like look-controls also enabled on the same entity or it will be overridden.
You can need to make sure this is the correct pointer. When you wrap in function (), this becomes window. You can use (evt) => { instead of function (evt) {
Using Google maps API V3, specifically using the drawing tools (only the rectangle is enabled) as seen here:
https://developers.google.com/maps/documentation/javascript/overlays#drawing_tools
But I have the following question,
Can I (if so how), by action of the user clicking a link on the same page, retrieve the lat,lng of the top left corner of the polygon and the bottom right, and send to a url, ie;
http://foo.bar/script.php?latoftopleft=17.4479216&longoftopleft=78.37720100000001&latofbotright=17.443172404867163&longofbotright=78.39395944192506
Retrieving the Rectangle
One way to retrieve the rectangle drawn by the user is to use Drawing Events:
var rectangle;
google.maps.event.addListener(drawingManager, 'rectanglecomplete', function(newRect) {
rectangle = newRect;
});
Whenever a rectangle is drawn by the user, it will assign the Rectangle overlay object to the rectangle global variable.
Extracting information about the Rectangle
The google.maps.Rectangle class has a getBounds() method, which returns a LatLngBounds object. You can use the getNorthEast() and getSouthWest() methods to deduce the top-left and bottom-right corner coordinates.
You can bind an onclick event to the link. The click event handler might look something like this:
function clickEventHandler(event) {
// check if the rectangle has been assigned
if (rectangle == undefined) {
alert('No rectangles have been drawn yet!');
return;
}
// obtain the bounds and corner coordinates of the rectangle
var rectangleBounds = rectangle.getBounds();
var northEast = rectangleBounds.getNorthEast();
var southWest = rectangleBounds.getSouthWest();
// deduce the top-left and bottom-right corner coordinates
var topLeft = new google.maps.LatLng(northEast.lat(), southWest.lng());
var bottomRight = new google.maps.LatLng(southWest.lat(), northEast.lng());
// Now that you have the coordinates, all you have to do is use an AJAX
// technique of your choice to send the HTTP request to script.php.
// ...
}
Further reading:
How do I bind a click to an anchor without a framework (javascript)
Pure Javascript send post data without a form
I am building an RIA application using Flex 4.6 that contains a main borderContainer (page) that can contain some other borderContainers (graphic or text elements).
I added an event listener on the page to listen to click events:
page.addEventListener(MouseEvent.CLICK, clickHandler, true);
clickHandler looks like this:
private function clickHandler(event:MouseEvent):void
{
// Remove event listeners
page.removeEventListener(MouseEvent.CLICK, clickHandler, true);
// Get click position
objX = event.localX;
objY = event.localY;
}
My problem is that although the event's currentTarget is always the page (normal), the target can either be the page or one of its children, and then localX doesn't give me the position on the page but on the child.
Is there a way to make sure the page is always the target of the event? Something like stopping the capturing phase on the page so it doesn't go deeper?
Thanks in advance for your help
Darrel
I think you may be asking the wrong question. As I understand it, you want the x/y position relative to 'page'. You can use the DisplayObject#globalToLocal() function to find this.
Just take the the global coordinates and convert them to local coordinates relative to 'page':
var coordinates:Point = new Point(event.stageX, event.stageY);
coordinates = page.globalToLocal(coordinates);
objX = coordinates.x;
objY = coordinates.y;
I'm currently working on a project that requires that I have a div stacked above a Google Map. However, I need to pass the mousemove event of the div to the Map. To do that, I need to find the LatLng co-ordinates from the map container pixel co-ordinate (since triggering the Maps mousemove event requires the LatLng co-ordinates).
Is there any other way to pass the mousemove event from the div to the map, and if not, how do I go from the Map container co-ordinates to LatLng. I read that doing so requires creating a dummy overlay, and then using the getProjection() on that to get a MapCanvasProjection, and finally calling the fromContainerPixelToLatLng(). Is there any simpler way or do I really have to create a dummy overlay first?
As far as I can tell, this is the way you have to do it. I was reluctant at first, too, since it seemed like such overkill, but once I did it everything worked great. Here's an example implementation with a convenient delayedInit() callback:
function Dummy(map) {
this.setMap(map);
}
Dummy.prototype = new google.maps.OverlayView();
Dummy.prototype.draw = function() {
if (!this.ready) {
this.ready = true;
google.maps.event.trigger(this, 'ready');
}
}
Dummy.prototype.onAdd = function(){
// the Overlay dummy is ready and can be called upon
delayedInit();
}
var dum;
... and after you've instantiated your Google map:
dum = new Dummy(map);
I'm trying to enable a double click event on a flex control without disabling the default mouseup/mousedown behaviors.
I'm using the ESRI Flex API for arcgis server, and I have a map control with one background layer and a GraphicLayer. The graphics layer has several Graphic objects that respond to mouseover, and allow the user to pan the map if they click and hold. However, when I implement a double click event handler for the graphic objects, they no longer seem to bubble up their default behavior to the map.
Is there a way to implement a double click on a Graphic object while preserving the old behavior from clicking and holding?
I solved this by attaching the double click event to the map, rather than the graphic, and using the target attribute of the event to get the graphic I wanted to use.
Like this:
map.addEventListener(MouseEvent.DOUBLE_CLICK, function(event:MouseEvent):void
{
var graphic:Graphic = event.target as Graphic;
if(graphic)
{
...
}
});
If you set the "checkForMouseListeners" property to false on your Graphic objects, then the default map click/drag behavior will be preserved.
graphic.addEventListener(MouseEvent.DOUBLE_CLICK, function(event:MouseEvent):void {
var graphic:Graphic = event.target as Graphic;
if(graphic) {
...
}
});
//preserve the default click/drag behavior on the map
graphic.checkForMouseListeners = false;
http://resources.esri.com/help/9.3/ArcGISServer/apis/Flex/apiref/com/esri/ags/Graphic.html#checkForMouseListeners