MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




HTML, activeX and Javascript - Union method problem

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2005
Junior Member
White Belt
 
Join Date: Jun 2005
Posts: 7
HTML, activeX and Javascript - Union method problem

Hi,
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();
It is very similar to the example on the MSDN VB Union method page, but my code throws the error:
"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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 06-15-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Your question saved me time I was just busy with some code to move some pushpins to a dataset for using the ZoomTo() method because I was unaware of the union method. So I tryed following to see if works:

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();
And it does. Possible that your code trows an exception because one of the pushpins is not found ? Because I think it really needs this check.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 06-15-2005
Junior Member
White Belt
 
Join Date: Jun 2005
Posts: 7
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:
Location[] aLoc = new Location[3];
And it doesn't work for me

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();
But this still throws the error "The parameter is incorrect".

What are you developing on/in?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 06-15-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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.

??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 06-16-2005
Junior Member
White Belt
 
Join Date: Jun 2005
Posts: 7
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 06-16-2005
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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();
(could be different of course)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 06-16-2005
Junior Member
White Belt
 
Join Date: Jun 2005
Posts: 7
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 06-16-2005
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 06-16-2005
Junior Member
White Belt
 
Join Date: Jun 2005
Posts: 7
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:
prohibit true Internet use
?

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 06-16-2005
Winwaed's Avatar
Mapping-Tools.com
Red Belt
 
Join Date: Feb 2004
Posts: 899
Blog Entries: 10
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
activex, html, javascript, method, problem, union


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 04:07 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54