You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "FlashinnaPano" started this thread

Posts: 29

Location: Orygun, USA

  • Send private message

1

Friday, February 5th 2010, 6:15am

How to add subnodes to map creation action?

Hello,

I am attempting to write an action to create a Google Map. Because I plan on using a number of Google Maps in my xml files, it seemed worthwhile to have one action to create the maps,

So far I have written an action that will successfully create the Google Map plugin itself but have been unable to figure out how to add subnodes such as radar and zoomcontrol. I have tried any number of variations without success.

Is this even close to the correct subnode syntax?

Source code

1
2
3
4
5
6
7
8
9
10
<action name="make_map">
	addplugin(Gmap);
	set(plugin[Gmap].url,%SWFPATH%/plugins/googlemaps.swf);
	set(plugin[Gmap].width,350);
	set(plugin[Gmap].height,350);

[...]
	set(plugin[Gmap].subnode[zoomcontrol].visible, true);
	set(plugin[Gmap].subnode[zoomcontrol].anchor, topleft);
</action>

Obviously, I am missing something very basic and important. What is the correct syntax for adding and defining subnode properties in an action?

For spot subnodes should I create them as the other map subnodes or should I use the addspot() function?

I have at least been able to write an action using addspot() to add map spots.

Once I get this map action working, what is the best way to execute it? As part of onstart?

I've searched the web site, release notes, and forum, but have not found any clues as to the correct subnode action syntax. I hope I have not missed something obvious....

Any help getting me properly oriented will be much appreciated!

Köszönöm,
Joe

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

2

Friday, February 5th 2010, 3:57pm

radar is a separate plugin that sits on top of the googlemap. create a separate action to create the radar plugin set its zorder higher than the map and set the parent="googlemaps"

  • "FlashinnaPano" started this thread

Posts: 29

Location: Orygun, USA

  • Send private message

3

Saturday, February 6th 2010, 6:54am

Hello,
Much clearer now. I had an idea the solution might be like that but was unable to find out how to "link" the actions. I never would have guessed the solution. The release notes are a bit cryptic .

Thanks
Joe

  • "FlashinnaPano" started this thread

Posts: 29

Location: Orygun, USA

  • Send private message

4

Sunday, February 7th 2010, 1:14am

Hello,
I was premature in thinking I solved this before testing.

Apologies if I am being totally clueless and dumb, so please bear with me, but I have had no success using actions to add googlemaps subnodes.

To start, I tried to use an action to add a zoomcontrol to my Google Map. Here's the first part of my map plugin (to keep testing simple I am not using the make_map action of my first post):

Source code

1
2
3
4
5
6
7
8
9
10
<plugin name="Gmap" url="%SWFPATH%/plugins/googlemaps.swf" 
	keep="true"
	visible="true" 
 	enabled="true" 
 	handcursor="false" 
	capture="true" 
 	children="true"
 	zorder="0"
[...]
</plugin>


Here's the action that I thought would add the zoomcontrol subnode to the map:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
<action name="make_zoomcontrol">
	addplugin(zoomcontrol);
	set(plugin[zoomcontrol].url,%SWFPATH%/plugins/googlemaps.swf);
	set(plugin[zoomcontrol].zorder,1);
	set(plugin[zoomcontrol].parent, Gmap);
	set(plugin[zoomcontrol].visible, true);
	set(plugin[zoomcontrol].enabled,true);
	set(plugin[zoomcontrol].anchor, topleft);
	set(plugin[zoomcontrol].x, 10);
	set(plugin[zoomcontrol].y, 5);
	set(plugin[zoomcontrol].hasscrollltrack, false);
	plugin[map].updatecontrols();
</action>


The zorder=1 (Gmap zorder=0) and the parent is the Gmap plugin. I'm not to sure about the proper url and the necessity of updatecontrol().

Whatever the case, this make_zoomcontrol action does not work. Can anyone tell me what I am doing wrong or show me a working example?

Similarly, I am attempting to write another action to add the Google Map radar. Using this radar action, I am able to add the radar from radar.swf to my Google Map, but haven't had any success in adding the googlemaps.swf radar subnode. The attributes of the radar in googlemaps.swf are different from radar.swf, and I need to use the googlemaps radar.

Other than the spot subnode, is it even possible to use actions to add the other googlemaps subnodes?

Well, I am now very confused by all this....
Joe

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

5

Sunday, February 7th 2010, 6:56pm

the zoomcontrol is not an external plugin. zoomcontrol is built into gmaps do not need to create a plugin for that. just position it where you want it. the radar is external and would need to be created using the same idea as you are trying for the zooomcontrols.

Source code

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
55
56
<plugin name="mapslogo"
			url="gmaps.png"
			align="centerbottom"
 	        x="250" y="10"
			width="30"
			height="30"
			onhover="showtext(Click to open a Google Map,smalltext)"
			onover="        tween(plugin[mapslogo].width,35,distance(318,0.5),easeoutquad);tween(plugin[mapslogo].height,35,distance(120,0.5),easeoutquad);"
			onout="tween(plugin[mapslogo].width,30,distance(318,0.5),easeoutquad);tween(plugin[mapslogo].height,30,distance(120,0.5),easeoutquad);"
			onclick="tween(plugin[maps].x,25,0.3,easeoutquad,set(plugin[maps].onout,set(plugin[maps].onout,null);tween(plugin[maps].x,-400);));"
			zorder="4"
			keep="true"
			visible="true"
			/>

<plugin name="maps" url="../core/plugins/googlemaps.swf" handcursor="false"
			align="rightcenter"
			x="-300"
			y="0"
			width="300"
			height="60%"
			zorder="0"
			
			xonover="tween(plugin[maps].x,40);"
			xonout="tween(plugin[maps].x,-300);"

			key="ABQIAAAAAOUDvWwlS_Wxbh9Jgbx1fBR5aKurEJ6TSpp_I-EAQPQB7zYUUxSK_8Sk1pOF8OJ8m4zZyG4T5QEXvQ"

			lat="46.784002"
			lng="-92.101951"
			zoom="16"

			maptype="SATELLITE"

			dragging="true"
			scrollwheel="true"
			continuouszoom="false"
			keyboard="false"
			crosshairs="false"

			onmapready=""
			onmapmoved=""
			onmapzoomed=""
			keep="true"
			
	>

		<positioncontrol visible="true" anchor="topleft"  x="2" y="2" />
		<zoomcontrol     visible="true" anchor="topright" x="2" y="2" hasscrolltrack="true" />

	<spot name="s1" lat="46.784002" lng="-92.101951" 
		      onhover="showtext(get directions to the Alworth/Lonsdale Buildings,smalltext);" 
		       onclick="openurl(http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=306+w+superior+st+55802&sll=46.784516,-92.101951&sspn=0.007449,0.013733&g=306+w+superior+st+duluth+mn&ie=UTF8&ll=46.784002,-92.101951&spn=0.007449,0.013733&t=h&z=16);" />			  


</plugin>


if i wanted to use radar i would add this.

Source code

1
<plugin name="radar" url="../../core/plugins/radar.swf" zorder="13" Parent="maps" origin="lefttop" edge="center" visible="true"  x="75" y="140" width="80" height="80" keep="true" heading="30" blendmode="subtract" alpha=".5"/>	


radar might not work on a real time google map. the spots are set via lat and lon settings not X and Y. unless you can set the radar parent to the spot itself i have not tested that.

  • "FlashinnaPano" started this thread

Posts: 29

Location: Orygun, USA

  • Send private message

6

Sunday, February 7th 2010, 9:07pm

Hello,

Thanks for the reply and taking the time to look at my problem. I understand what you are saying, but the problem I am trying to solve is somewhat different.

It might be best to summarize what I would ideally like to accomplish:
  • Global.xml file --> Contains actions and other code common to all panorama xml files. In this file I want to place an action to create the googlemap along with actions to create googlemap subnodes such as zoomcontrol and googleradar.

  • Panorama.xml files --> There will be many (>100) of these for the various panorama locations. Here I would call the googlemap action with lat, lng, heading, zoom, etc. as parameters to create the localized googlemap.

Because most of the googlemap xml will be the same for each panorama, I thought it would make sense and be more efficient to create actions to reuse this common xml. (Is there any Jedi xml trick to do this without actions?)

Thus far, I have only been able to write an action to create the basic googlemap plugin without any of the subnodes.

As for the various googlemap subnodes, I have found that it is only possible to create spot subnodes using the addspot() function.

I now suspect that without functions similar to addspot() it is not possible to use an action to add any of the other googlemap subnodes.

Perhaps Klaus might be willing to offer some enlightenment on this Quixotic quest

Cheers,
Joe

7

Tuesday, February 9th 2010, 2:12pm

Hi,

sorry, I'm sure what you want to do exactly...
have you tried <include>...?

best regards,
Klaus

  • "FlashinnaPano" started this thread

Posts: 29

Location: Orygun, USA

  • Send private message

8

Tuesday, February 9th 2010, 8:20pm

Hello,

This whole thread is getting a bit confusing, I think. *sad*

Yes, I have tried using include ....

But, if have defined in the global.xml file a <plugin name="Gmap" [etc.]</plugin>, then all of the googlemaps parameters in my plugin are static and cannot be modified from the pano.xml file where I have the include.

What do I do in the various pano.xml files if I want to change the lat, lng, or zoom for the googlemap?

The only method I can see is to use an action ... and I don't see how I can create the googlemaps radar, zoomcontrol etc. via an action.

Gaahh!! Am I dumb!?! Or what? *cursing* No, do not answer that....

Just now a 1000W light bulb lit up in my mind and I realized what to do. Klaus, either you are very subtle in your programming or I am completely clueless at times. *g*

So, the answer is: Yes, create a default googlmaps plugin (with no spots) in the global.xml file.

In each of my pano.xml files I only need to write an action such as this:

Source code

1
2
3
4
5
6
7
8
<action name="fill_map">
	plugin[Gmap].addspot(test1, 45.394369, -121.69954, 94.4, true,);
	plugin[Gmap].addspot(test2, 45.39768, -121.704531, 81.4, false, action(load_location, test2), showtext(Spot 2));
	
	plugin[Gmap].pantospot(test1);
	plugin[Gmap].setzoom(12);
	plugin[Gmap].updatespots();
</action>

Then I call this action as part of my show googlemap button plugin. Very simple and seems to work efficiently.

This took me longer to get working because I originally had plugin[Gmap].resetspots(); as the first line in the action. This unexpectedly deleted the spots created by the action itself. It seems that this clean-up is done automatically when switching from one location to another?

Now, if only ... double-clicking on the googlemap would zoom in as with a standard Google Map. *smile*

Thank you for not revoking my license *whistling*
Joe

9

Wednesday, February 10th 2010, 4:04pm

Hi,
It seems that this clean-up is done automatically when switching from one location to another?
the spots itself will not be cleaned-up automatically normally,

but when loading a new pano and the plugin don't have the - keep="true" attribute set,
then the plugin will be removed,
and when the new pano also includes the googlemaps plugin, then a new fresh plugin
will be created,


Now, if only ... double-clicking on the googlemap would zoom in as with a standard Google Map.
sorry, double-clicking is currently not possible,
(maybe in the next release)

best regards,
Klaus

VN2009

Professional

Posts: 1,334

Location: Duluth MN

  • Send private message

10

Wednesday, December 22nd 2010, 3:17am

Flash I ran into the same problem as you. I only want the position controls visible on my large map and not the small one. SO i need to adjust subnode settings like you needed. Rereading this i realized i was totally offbase on what you were asking. this should help i am about to start testing now.

XML Interface / Access


•the XML structure is mapped into a linear direct access structure:

•the names of the nodes are joined together and seperated by a dot
•the name of the attribute is also added and seperated by a dot
•nodes which are defined more then once (like plugins, hotspot, ...) must have a "name" attribute for identification.
•this name is used as index for direct access.
syntax examples:
node[name].attribute
node[name].subnode.attribute
node[name].subnode[subnodename].attribute

Similar threads