jkuhlz


I followed the clustering tutorial found at http://www.viavirtualearth.com/vve/Articles/Clustering2.ashx and highly recommend this tutorial as it answered all the questions I had in the application I was creating.

However, this tutorial was created using the Virtual Earth v 4.0. I am trying to upgrade to the 5.0 version but can't find a similar property "ShowDetailOnMouseOver" for the Pushpin. I see that the VEPushpin method has been changed to the VEShape class, but no luck on a "ShowDetailOnMouseOver" or equivalent property.

Thanks!




Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

CSUNRAE


You can use this

var shape = new VEShape(VEShapeType.Pushpin, LatLong);

the "shape" has all the properties you can set, even ShowDetailOnMouseOver






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

CSUNRAE

I found the ShowDetailOnMouseOver but unfortunately it does not work.

Anyone have any idea how to make the popup content on demand for Version 5 work.





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

Harvester

Try adding the following during your shape creation:

Code Snippet
markerShape.SetDescription( "some text or html" );

Once the description is set it will start popping up when you mouse over.

Also note that they've made it easier to customize the appearance of the popup box (called an infobox now). Take a look at the SDK:

http://msdn2.microsoft.com/en-us/library/aa905677.aspx

or

http://dev.live.com/virtualearth/sdk/

Cheers,

Greg





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

Derek Chan

The equivalent of the ShowDetailOnMouseOver is the VEMap "onmouseover" event. More details can be found here:
http://msdn2.microsoft.com/en-us/library/bb429627.aspx





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

bhowden

Funny, I am having trouble making "onmouseover" work. When I try:

vemap.AttachEvent('onmousemove', mapMouseMove);

function mapMouseMove(e)
{
alert ("mouse moved");

return false;
}

I never get an alert. All the other mouse events seem to work fine but not this one (at least for me!)

Brian






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

jkuhlz

So then since the information pulled for the mouse over is dynamically called from a webservice via the following code in version 4.0:

Code Snippet

VEPushpin.ShowDetailOnMouseOver = false;

VEPushpin.OnMouseOverCallback = PinHover;

in version 5.0 it could be converted to this:

Code Snippet
VEMap.AttachEvent("onmouseover", PinHover);

which would then call these functions just the same as in version 4.0:

Code Snippet

// on pin hover

function PinHover(x, y, title, details)

{

//we stored the pin ID in the details field

var ID = details;

var DivID = PopupPrefix + ID;

var e=document.getElementById(ID+"_"+map.GUID);

if(e!=null&&e!="undefined")

{

//create the default VE popup with loading text.

window.ero.setBoundingArea(

new Microsoft.Web.Geometry.Point(0,0),

new Microsoft.Web.Geometry.Point(document.body.clientWidth, document.body.clientHeight));

window.ero.setContent("<div style='height: 200; width: 225px' id='" + DivID + "'>Loading...</div>");

window.ero.dockToElement(e);

//get the content for the pin.

getAJAXContent(ID,pins[ID].bounds,0);

}

}

Is this correct





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

jkuhlz

After attempting to incorporate the new version 5 features, I have run into a stumbling block. In version 4 you could use the OnMouseOverCallback feature and call a function that had the the variables "x, y, title, details" passed as parameters. Which would allow for getting content on demand like the following example found at http://www.soulsolutions.com.au/Articles/PopupContentonDemand/tabid/98/Default.aspx.

In version 5, I know you can do the

Code Snippet

map.AttachEvent("onmouseover", functionname);

to call a function that occurs on mouse over. If it returns true it only handles the custom method.

The issue I am running into is getting the ID that was set in the detail of the popup to then get the real content through the AJAX webservice. Bascially, I guess I am looking for help on converting the example found at SoulSolutions to version 5.

Thank you!





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

CSUNRAE

Can someone from the microsoft team please reply to this thread.

Basically all we want to know how we can call a custom function when you hover over a VEShapeType.Pushpin. The following code does not work.

Code Snippet

var markerShape = new VEShape(VEShapeType.Pushpin, latlong;

markerShape.Id = 1;

markerShape.SetCustomIcon(myIcon);

markerShape.ShowDetailOnMouseOver = false;

markerShape.OnMouseOverCallback = OnMyMouseOver;

markerShape.SetDescription('1');

//Add the shape the the map

map.AddShape(markerShape);

function OnMyMouseOver(x, y, title, details) {

alert(x + ' | ' + y + ' | ' + title + ' | ' + details);

}

Even this code snippet does not work and you only get it once when you hover over your map.

Code Snippet

map.AttachEvent("onmouseover", functionname);

Thanks,

Csun






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

CSUNRAE

anyone else has this issue

please provide some samples for on demand detail.






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

Alexandru Matei

Hello,

In V5, this code works for me:

var latitude = 42.098;

var longitude = -102.216;

//after loading the map, attach the event

map.AttachEvent('onmouseover', OnMouseOverV5);

//then create a pushpin

var infoBoxTitle = "Some Title";

var infoBoxText = "Some Text";

var pin = new VEShape(VEShapeType.Pushpin, new VELatLong(latitude,longitude));

pin.SetTitle(infoBoxTitle);

pin.SetDescription(infoBoxText);

map.AddShape(pin);

function OnMouseOverV5(e)

{

if(e.elementID)

{

//mouse is over a pushpin (or over a shape)

var pin= map.GetShapeByID(e.elementID);

//change Info Box information just before displaying it!

var newInfoBoxTitle = "Some New Title";

pin.SetTitle("<div class='titleStyle' >"+ newInfoBoxTitle+" </div>");

var newInfoBoxText = "Some New Text";

pin.SetDescription("<div class='detailsStyle' >"+newInfoBoxText+"</div>");

// or if you want to prevent executing the default behaviour, that is don't show the Info Box, then uncomment the line below

// return true;

}

}





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

SoulSolutions

Alex is spot on.

If you want to load the content on demand (like from a web service call) then return true to cancel the default box and when you load the real content call:

map.ShowInfoBox(currentpin)

I'm working hard to get the cluster article updated for V5, most problems are solved.

John.






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

Alexandru Matei

Hi,

My unsolved problem in V5 of the Earth Map is how to assign a "user defined object" or at least "user defined variable" to the pushpin, when the pusphpin is created.

- In summary, I want the normal info box to appear on mouseover (which it does).

- However I'd like the content of the info box to be determined dynamically based on some "user defined ID" already assigned to the pushpin when it was created, telling me which pushpin the mouse is over.

- In the same way, I'd like the content of the info box displayed when a pushpin is clicked to be determined dynamically
based on that ID, telling me which pushpin is clicked.

- If I don't assign such an ID to the pushpin when it's created, I can't make the AJAX callback to and get more details for that pushpin.

Please have a quick look here:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1637020&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1142952&SiteID=1

Thank you very much.





Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

SoulSolutions

Alex I did this by adding some custom properties to the shape object itself in my map load:

//Setup additional storage for shapes

VEShape.prototype.Bounds = "";

VEShape.prototype.Drawn = false;

VEShape.prototype.Match = false;

For example here i store the overall bounds the clustered pin covers and also boolean values to determine if to draw / remove for my pin differential.

So withing my process loop I can do this:

var newShape = new VEShape(VEShapeType.Pushpin, loc);

newShape.Bounds = bounds;

newShape.Drawn = drawn;

newPins.push(newShape);

and then on activation I can do this:

//call the web service

this._service.GetPushPin(this._currentpin.Bounds, this._currentindex, Function.createDelegate(this, this.OnContentSucceeded), Utility.OnFailed, this._currentpin.GetID());

I haven't quite finished a V5 solution and honestly won't have time until the weekend to do so but if your totally stuck send me an email and I'll send you where I'm upto - maybe you can help me solve the last couple of bits All the code is now Object Orientated AJAX but far less classes then the old V4.

John at soulsolutions.com.au






Re: ShowDetailOnMouseOver in V5. Which pushpin is clicked or which pushpin the mouse is over.

jkuhlz

Thanks for the information... how soon to the V5 solution as I have a project that this would work great for! I thought I had successfully updated the V4 solution. But am running into some issues.

Thanks!