Community of VE/MapPoint Users and Developers
This is a discussion on HTML, activeX and Javascript - Union method problem within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I'm developing a web application in php and I'm trying to control some aspects of the ActiveX component with ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| HTML, activeX and Javascript - Union method problem I'm developing a web application in php and I'm trying to control some aspects of the ActiveX component with Javascript. The problem I am having is with the Union method. I want to beable to display several pushpins on the map (which I can do) and then zoom out and center the map view so all pushpins can be seen on the current map view - precisely what the Union method promises to do. Here's my code: Code: var objLoc1 = map1.ActiveMap.FindPushPin(ar[0].rtu_id).Location; var objLoc2 = map1.ActiveMap.FindPushPin(ar[1].rtu_id).Location; map1.ActiveMap.Union(Array(objLoc1, objLoc2)).GoTo(); "The parameter is incorrect" I've tried defining the array before the union method and just using the array reference but that throws the same error. Any ideas? |
| |||
|
Hi, Your question saved me time Code: Pushpin pp;
int count = 10;
double lon = 50;
while (count-- > 0) {
lon += 0.5;
Location loc = MP.ActiveMap.GetLocation(lon, 4, 1);
pp = MP.ActiveMap.AddPushpin(loc, count.ToString());
pp.Symbol = 1;
}
Location[] aLoc = new Location[3];
aLoc[0] = MP.ActiveMap.FindPushpin("1").Location;
aLoc[1] = MP.ActiveMap.FindPushpin("2").Location;
aLoc[2] = MP.ActiveMap.FindPushpin("3").Location;
MP.ActiveMap.Union(aLoc).GoTo();
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
I am fairly confident my pushpins are being found, objLoc1 and objLoc2 are both objects. Is your code Javascript? I don't recognise some of the format eg: Quote:
If I alter your code so it works for me I get: Code: count = 10;
lon = 50;
while (count-- > 0) {
lon += 0.5;
Location loc = MP.ActiveMap.GetLocation(lon, 4, 1);
pp = MP.ActiveMap.AddPushpin(loc, count.toString());
pp.Symbol = 1;
}
aLoc = new Array(3);
aLoc[0] = MP.ActiveMap.FindPushpin("1").Location;
aLoc[1] = MP.ActiveMap.FindPushpin("2").Location;
aLoc[2] = MP.ActiveMap.FindPushpin("3").Location;
MP.ActiveMap.Union(aLoc).GoTo();
What are you developing on/in? |
| |||
|
Hi, No the code example I posted is C#. This looks very mutch like JavaScript, so as you have done you only need very minor modifications to have it work for you, and yes the "strange" code from me is the New Array One more question. If I understeand you when you say "it works" and also "it trows the error", do I understeand it right that: - the GoTo() function _is_ working, eg the map zoom to the pushpins. - the very same Goto() function trows an exception with the "The parameter is incorrect" message. ??
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Sorry I didn't make that very clear, I'll try again: The "The Parameter is incorrect" error is coming from the Union() Method. So the code fails at the Union() method so the GoTo() method is not called. (I've tried the GoTo() method on a different single location object and that works as intended.) I really can't see what I'm doing wrong, to the best of my knowledge both objLoc1 and objLoc2 (in my original code) are location objects. Then I simply put them into an array and use that array as the argument for the Union() method, which then results in the error message "The parameter is incorrect". Any ideas? |
| |||
|
Hi, I'm just guessing, but maybe calling convention ? Maybe JavaScript try to push the array on the stack, try to pass is explicitely by address. Dont know the syntax, probably something like: Code: MP.ActiveMap.Union(&aLoc).GoTo();
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi, I don't fully understand your last post, about calling conventions and "the stack", but will attempt a reply: I'm not sure that javascript has as complex a calling convention as C#. Objects and arrays are always passed by reference in javascript. Suffice to say, your suggested code syntax is not valid in javascript and I cannot find anything resembling what you are after. But, thanks for trying. Am I the only person trying to control the mappoint activeX object with Javascript??? Has no one come across this, or similar, problem before? |
| ||||
|
It is possible that you're one of the first people to try it. The EULA (and the physical practicalities of distribution) prohibit true Internet use of the MapPoint ActiveX control. Intranet use is viable, but I don't think many people have gone this route - a traditional application is easier and in many ways has advantages over the web-for-everything approach. Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
| |||
|
Richard, I don't recall the EULA mentioning the activeX control, though I suppose it probably wasn't worded as such. Could you elaborate Quote:
When you put it that way I guess not so many people would bother going down the html embeded activex control route. My web application can use several different types of mapping solution. I just thought the mappoint activex control would be a lot smoother, faster and nicer solution, being client side and all. |
| ||||
|
For Joe Public to use the MapPoint Active X control, then they must have MapPoint installed on their PC. If you are relying on that stage, then I think you're okay (although there are various caveats in the EULA about internet use - eg. a query application that queried a server-based MapPoint for images on demand is explicitly limited). [and this is why I say an Intranet should be okay: you or your sysadmin has already installed legal copies] How many users will have MapPoint already installed? I suspect not that many. So some people have talked about having a "download" on their site which downloads the control. This is impractical because of the large amount of attached data/etc. It is also prohibited, as it essentially software piracy. Similarly if you distribute your own application with an embedded control, you cannot distribute the control with your software - you have to demand your user installs it beforehand. (you might be able to get Microsoft to go in for a large licensing scheme, but that will up your costs a lot!) Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools Pre-Order MapPoint 2009 today: http://www.mapping-tools.com/mappoint2009 |
![]() |
| Tags |
| activex, html, javascript, method, problem, union |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can I embed MapPoint ActiveX Ctrl in HTML with JScript/VBScr | Anonymous | MapPoint 2006/2009 Discussion | 2 | 01-16-2006 04:01 AM |
| Problem saving map to html | MarkStanley | MapPoint 2006/2009 Discussion | 1 | 09-22-2005 03:24 PM |
| PrintOut method with MapPoint ActiveX control?!! | TheJudge | MapPoint 2006/2009 Discussion | 3 | 04-13-2004 06:35 PM |
| Problem with the optermise method | Anonymous | MapPoint 2006/2009 Discussion | 0 | 07-14-2003 10:06 AM |
| problem with IMPORT-method | Anonymous | MapPoint 2006/2009 Discussion | 1 | 06-04-2003 09:41 AM |