inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 1, 2010 16:41:59 GMT -8
Board URL: lostlambton.proboards.com/index.cgiThis is weird: I'm trying to embed the Google Earth API (scroll to "Complete example" for code) in my forum using the Secure Script/HTML in Posts code from the SoCal forum (I've used it successfully many times before). I placed the GE API code (minus the <head> and <body> tags) in the HTML OR JAVASCRIPT HERE area of the SoCal code and posted the complete code in the LLF3D board's footer (link below). In IE, if I go directly to the URL of the thread in the LLF3D board, where I made a post using the posting tag, the GE plugin loads with no problems: lostlambton.proboards.com/index.cgi?action=display&board=llf3d&thread=110&page=1#210 But, if I go to the LLF3D board's main page, IE crashes every time. (CAUTION!) lostlambton.proboards.com/index.cgi?board=llf3dIf I use IE 64 bit, it doesn't crash, but that just seems to be because the plugin won't load in the 64 bit version... Chrome doesn't exibit this problem and loads all pages fine. The GE plugin won't seem to work in FF, so it doesn't crash either... Can anyone help me with this? TIA
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 1, 2010 18:24:10 GMT -8
Board URL: lostlambton.proboards.com/index.cgiThis is weird: I'm trying to embed the Google Earth API (scroll to "Complete example" for code) in my forum using the Secure Script/HTML in Posts code from the SoCal forum (I've used it successfully many times before). I placed the GE API code (minus the <head> and <body> tags) in the HTML OR JAVASCRIPT HERE area of the SoCal code and posted the complete code in the LLF3D board's footer (link below). In IE, if I go directly to the URL of the thread in the LLF3D board, where I made a post using the posting tag, the GE plugin loads with no problems: lostlambton.proboards.com/index.cgi?action=display&board=llf3d&thread=110&page=1#210 But, if I go to the LLF3D board's main page, IE crashes every time. (CAUTION!) lostlambton.proboards.com/index.cgi?board=llf3dIf I use IE 64 bit, it doesn't crash, but that just seems to be because the plugin won't load in the 64 bit version... Chrome doesn't exibit this problem and loads all pages fine. The GE plugin won't seem to work in FF, so it doesn't crash either... Can anyone help me with this? TIA I have absolutely no experience working with this plugin but a quick glance at your forum's source shows an obvious problem: The GE code as written was intended to cater to a single instance of the plugin but the way it's being used at least 2 instances are created when viewing a thread with the plugin embedded. This is all conjecture but here is what I believe is occurring, the first instance is of course the code inside the hidden ge_api_llf3d_01 span. With IE I know that it will issue an error when an element contained within a hidden element tries to make itself visible. This just may be the reason the plugin crashes when the hidden instance is the only one on the page. With the secure html script COPYING EVERYTHING inside the hidden span (including duplicating a div with with an id) and writing it out to a post a second instance is created. This instance however is not bound by a hidden container so when initialization occurs ... function initCB(instance) { ge = instance; ge.getWindow().setVisibility(true); }
... and that red line is called no error occurs on that second instance. You can easily test this theory by temporarily removing the "display:none" style from the span and reload the main page in IE. You will also notice that with the initialization of the second instance the reference to the previous instance is overwritten by that line preceding the red line since that version of the code you're using is not multiple-instance capable, you may want to look for a multi-instance version. Also from what I see the only thing that needs to be called is the google.earth.createInstance('map3d', initCB, failureCB); line for each additional instance once the framework has been loaded (with a uniquely generated ID for each instance which the secure HTML code has no provision for). This in fact looks like it would need a custom made code to get it working but I'm unclear on what the benefits are of having multiple instances embedded inside posts rather than a single. Perhaps you could go into more detail on what you're tying to achieve so I can say whether such a code is feasible since as I said I'm not very familiar with this plugin.
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 3, 2010 15:33:47 GMT -8
Thanks Eton, I'm pretty new to this coding, so I'm just muddling through myself, but you've given me some ideas I will try when I have a chance. The reason I'm trying to use this plugin in my forum is because my local history forum is frequented by a lot of "silver hairs" with very little computer savvy and I want to be able to share 3d models on GE with them, but good luck getting them to look at them if they have to dl a .kmz file and install GE first. I don't necessarily need multiple instances of the plugin on one page of posts, but it should be possible, as well, as there are examples of that: earth-api-samples.googlecode.com/svn/trunk/demos/multiple/index.htmlI don't get why going directly to the page with the post works but going to the page who's footer the code is in crashes IE but not Chrome...
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 3, 2010 16:25:48 GMT -8
If you view source of that multiple instance example you just linked, you'll see that the JavaScript portion is vastly different from what you are now using. In particular the variable used to hold reference to the plugin is defined as an array in order to support multiple instances instead of the previous reference being overwritten each time a new reference is added.
As for the crashing, did you try what I said?
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 3, 2010 17:03:41 GMT -8
As for the crashing, did you try what I said? Yes and when I did, the LLF3D page doesn't crash, but the plugin loads at the bottom left of it...
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 3, 2010 17:33:44 GMT -8
That's the hidden ge_api_llf3d_01 instance I spoke of and if IE is no longer crashing then that proves the theory that it was because that instance was hidden why IE was crashing.
If it was unclear before about what I was saying then unhiding it should now make it plain that at least TWO GE plugins are on the page once another is inserted into a post but the code in use can only track ONE at a time. This can and will lead to problems especially since they both share the same exact internal id as well as a div that gets replicated each time a new instance is created resulting in multiple elements sharing the exact same id.
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 4, 2010 13:40:08 GMT -8
Thanks Eton,
So, as you can probably figure out, I'm not a code guy. So, is there a way to modify this to eliminate problems and still maintain functionality?
I think this would be a nice piece of custom code and feature for ProBoards; I'm just not qualified to write it.
TIA
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 5, 2010 0:58:43 GMT -8
Well you apparently know more about the capabilities of this plugin than I do since I'm still scratching my head trying to figure out how this would allow demos of models, I assume it has to do with customization through kml files...
Anyway here's the framework for a code that would allow multiple instances of the plugin within posts.
Global Header: <script src="http://www.google.com/jsapi?key=ABCDEFG"> </script> <script>google.load("earth", "1");</script>
(obviously replace the API key with your own)
Global Footer: <script> (function(){ /* Google Earth in Posts */ if(!arguments[0])return pb={earth:{ pattern:"[ge_api_llf3d_01]", //text to be replaced in posts pluginHeight: '400px', //height of plugin in posts pluginWidth: '600px' //width of plugin in posts }}; var pe=pb.earth,posts,i,j,k,funcs=[]; pe.instances={}; pe.pattern = new RegExp(pe.pattern.replace(/[\[\]\{\}\^\$\\\/\*\+\?\.]/g,function(m){return '\\'+m}),'g'); pe.genID = function(){return 'pbEarth'+(arguments.callee.count++)}; pe.genID.count=0; pe.initCB= function(instance) { pb.earth.instances[pb.earth.id] = instance; pb.earth.instances[pb.earth.id].getWindow().setVisibility(true); } pe.failureCB = function(errorCode){} pe.init = function(){ var pe=pb.earth,pid=pe.genID(); pe.id=pid; //return pb.earth.genID(); return function(){google.earth.createInstance(pid,pb.earth.initCB, pb.earth.failureCB)} } for(posts=document.getElementsByTagName('hr'),i=0,j=posts.length;i<j;i++){ if(posts.className=='hr' && posts.nextSibling && posts.nextSibling.size && (k=posts.nextSibling.innerHTML) && k.indexOf("google_ad_section_")!=-1 && k.match(pb.earth.pattern)){ posts.nextSibling.innerHTML = posts.nextSibling.innerHTML.replace(pb.earth.pattern,function(m){ var pe = pb.earth; funcs.push(pe.init()); return '<div id="'+ pe.id +'" style="height:'+pe.pluginHeight+';width:'+pe.pluginWidth+'"><\/div>' }); } } for(i=0;i<funcs.length;i++)google.setOnLoadCallback(funcs); })(/(display|recent|p(m|re)view|search2)/.test(pb_action)) </script>
That is a bare minimum code with no bells or whistles (e.g. no dedicated UBBC button) since I'm still in the dark on the intended use. Perhaps when I see a concrete example then I would know where to take it.
Note this section of the code does offer some editing options pb={earth:{ pattern:"[ge_api_llf3d_01]", //text to be replaced in posts pluginHeight: '400px', //height of plugin in posts pluginWidth: '600px' //width of plugin in posts }};
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 5, 2010 15:17:45 GMT -8
First, of all WOW! Thanks very much Eton! It works great. The loading seems a bit slow (perhaps that's on the GE server side?), but other than that, this allows me to continue learning how to do what I'm trying to do... Well you apparently know more about the capabilities of this plugin than I do since I'm still scratching my head trying to figure out how this would allow demos of models, I assume it has to do with customization through kml files... That's exactly right. Although, I'm still trying to learn exactly how to do it... code.google.com/apis/earth/faq.html#kmlfilesI copied the code from the first example on the above link and used find and replace to substitute the variables in your pb code and then appended it to your code. I got it to work, but sometimes the .kml only seems to load on the first instance, but not the 2nd. Sometimes on both... lostlambton.proboards.com/index.cgi?board=llf3d&action=display&thread=110&page=1#1286309276What I'd really like to do though, is be able to enter the view info and .kml url into the post itself, rather than in the global footer, so that I can create multiple instances of the plugin in a thread, each with it's own custom .kml and view. Is there a safe way to input these variables within a post and have them used on a post by post basis in the footer code? If not, is there a way to do it in the footer code without having to repeat the entire code, with new pattern strings, for each instance? I'm also wondering if I might be able to use a Google Docs Spreadsheet form to input the pattern text, custom .kml url and view settings and have them exported to (or read) by your code somehow. This is really quite advanced stuff for me, so I really appreciate your help. It's probably not the best way to learn to do this kind of coding, but I am learning a lot as I experiment with the re-coding of the examples, etc. Thanks again!
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 5, 2010 19:22:57 GMT -8
You're welcome but it's a start not a finished product as I indicated. As for the loading that is per Google's specification which you'll see in any example they've offered, which is to not issue the call to load the plugin until the DOM has fully loaded (they've even provided a method on the interface for this: google.setOnLoadCallback ). I suspect this has to do with the vast differences between browsers as to what interfaces are made available before that DOMReady event has triggered so I made sure to utilize that method in the code as well.
As for the hit-or-miss kml overlays you've added I'm guessing that would need a rewrite due to the asynchronous nature of downloading. There is never a guarantee that multiple plugins will complete in the order they were initiated. This is why I used closure in that array of anonymous functions (rather than a static pb.earth.id ) so each function would be fingerprinted to the plugin it served, a similar method would be needed for the kml bindings.
It would be trivial to change the pattern to have an identifiable signature portion and a variable section which would contain the name of the kml file to apply to the GE instance but that would require you hosting the kml files in a central location. If the full url of the kml file is used in the pattern then it would be subject to a limitation built into Proboards regarding strings of consecutive non-space characters (118?) stretching the page .Also from what little I've seen the view info can be specified in the kml file itself (longitude, latitude, ect.) which would simplify things greatly.
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 6, 2010 14:10:43 GMT -8
So, I've got the post with the plugin working as I envisioned... Thanks again, Eton! lostlambton.proboards.com/index.cgi?action=display&board=llf3d&thread=110&page=1#207I guess the next question to you, or anyone else with the ability, would be, are you interested in developing this to it's logical conclusion; ie, the capability to have multiple instances of the plugin throughout a forum, each with a unique .kml overlay? I wish I could do it myself, but it would take months just to become proficient enough with java to begin, let alone succeed. I think this would be a great addition to the pb code collection and a great way to provide the power of GE to the masses not technically inclined to dl and use GE. At any rate, I appreciate what you've provided thus far.
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 6, 2010 20:20:22 GMT -8
So, I've got the post with the plugin working as I envisioned... Thanks again, Eton! lostlambton.proboards.com/index.cgi?action=display&board=llf3d&thread=110&page=1#207I guess the next question to you, or anyone else with the ability, would be, are you interested in developing this to it's logical conclusion; ie, the capability to have multiple instances of the plugin throughout a forum, each with a unique .kml overlay? I wish I could do it myself, but it would take months just to become proficient enough with java to begin, let alone succeed. I think this would be a great addition to the pb code collection and a great way to provide the power of GE to the masses not technically inclined to dl and use GE. At any rate, I appreciate what you've provided thus far. I'm truly impressed with how much you've accomplished in such a short time. I took a look at the source of the kml file after decompressing it and saw you've been quite busy, I do have a few questions for you though. Did you code that all by hand or does Google offer some authoring tool so someone not as adept at XML as yourself can also author kml files? Will you be able to use Google to host your kml files in the future or is that some kind of developer trial access? I assume kml/kmz files can be hosted anywhere not necessarily on Google's servers? If the answers to the above questions are as I expect then I foresee a variable: kmlHost = 'http://sketchup.google.com/3dwarehouse/download?mid=#kmlID#&rtyp=k2'with #kmlID# being replaced by the data within the post [ge_api_ea08627c339ff8a8a8565193078ecd50_01]I'm also seeing the view info within the kml file itself (which is what I expected) meaning doing a createLookAt in the code is redundant, the kml file can accomplish that all by itself. <LookAt> <longitude>-82.42193964593551</longitude> <latitude>42.99495566013626</latitude> <altitude>0</altitude> <heading>57.67196818672873</heading> <tilt>57.01497994474561</tilt> <range>145.2604207281967</range> <altitudeMode>relativeToGround</altitudeMode> <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode> </LookAt> The only obstacle I see is the fact that the plugin has been having trouble in Firefox since around Sept 19 th and that is my primary developing platform, hopefully this gets rectified soon.
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 7, 2010 18:32:41 GMT -8
I'm truly impressed with how much you've accomplished in such a short time. I took a look at the source of the kml file after decompressing it and saw you've been quite busy, I do have a few questions for you though. Did you code that all by hand or does Google offer some authoring tool so someone not as adept at XML as yourself can also author kml files? I wish I could take credit for being so adept, but the .kml is all Google's doing. I build the model in Google SketchUp, upload it to GE to geo-located it and save it as a .kmz file. As for getting the code working, I feel like someone learning a foreign language for the first time; so far I'm faking my way through with mimicry and observation. But, without you and Google to translate for me, I'd be screwed. I know enough about programming languages to understand their structure and logic, but the syntax is still largely gibberish to me. All I can do is make substitutions and adjust variables and see what happens, but it's a pretty inefficient way to accomplish anything. There's also this: code.google.com/apis/ajax/playground/?exp=earthand this: kml-samples.googlecode.com/svn/trunk/interactive/index.htmlto help learn. Google's 3D Warehouse is available for anyone to upload SU models (.kmz and/or .skp) to: sketchup.google.com/3dwarehouse/details?mid=ea08627c339ff8a8a8565193078ecd50As far as I know, there's no limit to the number of models you can store there. They'll also host .kmz files on the GE community forums up to 10mb, I believe. I have one there, too: bbs.keyhole.com/ubb/ubbthreads.php?ubb=showflat&Main=852754&Number=1281559I would imagine. That's a start, but wouldn't we need to strip all that .kml fetching code out of the footer and get it into the individual posts themselves in order to display unique .kml content in each post with a plugin? Take a look at this example: earth-api-samples.googlecode.com/svn/trunk/examples/kml-fetch-checkboxes.htmlI'm thinking it would be really neat to be able to use check boxes (or, radio buttons, etc.) in a post to choose from multiple .kml within a single plugin (for 'then/now' A/B comparisons, etc.) But, beyond that, am I correct to think this code could be adapted to load into a post (perhaps via the Secure HTML/Scripts code) and would allow the poster to enter a url into a form to load a .kml into the plugin that's been inserted into forum via a ubbc button, as you mentioned earlier? Yes, I would think that, too. But, when I try removing the createLookAt code, the plugin doesn't 'fly' to the 'view' in the .kml, so obviously some coding is needed to extract the info from the .kml. I've been playing around trying to incorporate the above example in your base code, but I'm not getting very far with my feeble attempts, so far...
|
|
inherit
Official Code Helper
65613
0
1
May 11, 2024 14:19:23 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,881
December 2005
horace
|
Post by Chris on Oct 7, 2010 20:37:58 GMT -8
That's a start, but wouldn't we need to strip all that .kml fetching code out of the footer and get it into the individual posts themselves in order to display unique .kml content in each post with a plugin? The kml file itself contains all the info so all the poster would need is to specify the name of the kml to be applied to the plugin. The highlighted portion(red) would be part of the text within the post itself letting the code know which kml file to load. I used that particular sequence of characters as an example since it happens to be the identifier of the kmz file that you used in your last post sketchup.google.com/3dwarehouse/download?mid=ea08627c339ff8a8a8565193078ecd50&rtyp=k2With just the identifier the code can then reconstruct the url and apply it.
But, beyond that, am I correct to think this code could be adapted to load into a post (perhaps via the Secure HTML/Scripts code) and would allow the poster to enter a url into a form to load a .kml into the plugin that's been inserted into forum via a ubbc button, as you mentioned earlier? The point of my creating that code is because the secure html code is unfit for this. The kml file can be specified using the method or similar to what I indicated above.
Yes, I would think that, too. But, when I try removing the createLookAt code, the plugin doesn't 'fly' to the 'view' in the .kml, so obviously some coding is needed to extract the info from the .kml. You'll need to take a look at this in order to figure out how to get the kml to flyTo upon load. It is important you get that figured out so all that coordinate specific stuff can be removed from the code, the alternative would be in addition to kml name, longitude, latitude, tilt, range, altitude, etc. has to also be specified in the post which would make the code considerably more complex.
Take a look at this example: earth-api-samples.googlecode.com/....checkboxes.htmlI'm thinking it would be really neat to be able to use check boxes (or, radio buttons, etc.) in a post to choose from multiple .kml within a single plugin (for 'then/now' A/B comparisons, etc.) I've been playing around trying to incorporate the above example in your base code, but I'm not getting very far with my feeble attempts, so far... It would be prudent to get the code loading a poster definable kml file first before talking about switching between kml files. I've rewritten the code to handle the loading of kml on multiple instances using JavaScript closure to get around that asynchronous problem I spoke of earlier but the ball is in your court as to what form the code will take Edit:
I took a look at the Earth API and came up with a solution to the automatic flyTo problem. This version of the code (footer portion) will search the KML file once it has loaded for a LookAt node and if found it will set the view to the coordinates of the first LookAt encountered. This version also implements the variable tag structure I mentioned earlier EXAMPLE Here you have two posts with with a Google Earth tag in each
|
Global Footer (header remains the same) :<script type="text/javascript"> (function(){ /* Google Earth in Posts */ if(!arguments[0])return pb={earth:{ kmlHost: [ //list of KML host (note: host MUST return correct mime type for .kml/.kmz) 'http://sketchup.google.com/3dwarehouse/download?mid=#kmlID#&rtyp=k2' ], pattern:/\[ge_api_(?.+?)_(\d+))?\]/gi, //GE placemarker in posts (regex) pluginHeight: '400px', //height of plugin in posts pluginWidth: '600px' //width of plugin in posts }}; var pe=pb.earth,posts,i,j,k,funcs=[]; pe.instances={}; pe.genID = function(){return 'pbEarth'+(arguments.callee.count++)}; pe.genID.count=0; pe.failureCB = function(errorCode){} pe.init = function(kml,index){ var pe=pb.earth,pid=pe.genID(),url; pe.id=pid; var initCB = function(instance) { var pei= pb.earth.instances[pid] pei = instance; pei.getWindow().setVisibility(true); // add a navigation control pei.getNavigationControl().setVisibility(pei.VISIBILITY_AUTO);
// add some layers pei.getLayerRoot().enableLayerById(pei.LAYER_BORDERS, true); pei.getLayerRoot().enableLayerById(pei.LAYER_ROADS, true); //fetch KML file and show it function finished(object) { if (!object){ document.getElementById(pid).appendChild(document.createTextNode('Invalid KML: ')); document.getElementById(pid).appendChild(document.createElement('span')).innerHTML = '<a target="_blank" href="'+url+'">'+url+'</a>' return; } pei.getFeatures().appendChild(object); var la = object.getElementsByType('kmlLookAt'); if(la.getLength()>1) pei.getView().setAbstractView(la.item(0)); //set to first LookAt found in KML }
// fetch the KML if("string"==typeof(kml) && kml.length && !isNaN(index) && index>0 && kmlHost[index-1]){ url = pe.kmlHost[index-1].replace(/#kmlID#/g,kml); google.earth.fetchKml(pei, url, finished); } } return function(){google.earth.createInstance(pid,initCB, pb.earth.failureCB)} } for(posts=document.getElementsByTagName('hr'),i=0,j=posts.length;i<j;i++){ if(posts.className=='hr' && posts.nextSibling && posts.nextSibling.size && (k=posts.nextSibling.innerHTML) && k.indexOf("google_ad_section_")!=-1 && k.match(pb.earth.pattern)){ posts.nextSibling.innerHTML = posts.nextSibling.innerHTML.replace(pb.earth.pattern,function(m,p,p1){ var pe = pb.earth; funcs.push(pe.init(p,parseInt(p1))); return '<div id="'+ pe.id +'" style="height:'+pe.pluginHeight+';width:'+pe.pluginWidth+'"><\/div>' }); } } for(i=0;i<funcs.length;i++)google.setOnLoadCallback(funcs); })(/(display|recent|p(m|re)view|search2)/.test(pb_action)) </script>
|
|
inherit
132005
0
Feb 15, 2011 17:54:29 GMT -8
sluggo7
23
October 2008
sluggo7
|
Post by sluggo7 on Oct 9, 2010 7:10:50 GMT -8
Eton, you ARE the MAN!! I've spent a while testing this, posting plugins throughout my forum and it seems to work flawlessly! I was comparing your earlier version and this latest and although I understood the necessity of a kml variable, it would have taken me months to figure out how to rewrite it as you've done. I've got two instances posted in one thread here: lostlambton.proboards.com/index.cgi?board=llf3d&action=display&thread=110&page=1and an instance posted as a guest in a different thread here (this one is 6mb and takes a while to load): lostlambton.proboards.com/index.cgi?action=display&board=gallery&thread=114In this last one, it was necessary for me to add a model into the .kml file, in addition to the map overlays, because the 3D Warehouse won't allow you to upload .kml files that don't contain at least one 3D model. Of course, I could just use a different host and adjust the url in the code, but using the 3D Warehouse is easy, free and consistent with the content, so I'll probably just create a small 3D logo model to include in the .kml when I want to display overlays, placemarks and other 2D content in the plugin. What I also like about the Warehouse is that when you edit models and re-upload them, the url doesn't change, which makes .kml updates really painless. One other observation: When I placed my 2nd model into the warehouse in order to generate a new .kml url for testing your code, I didn't include a placemark with the model. When I posted the plugin instance in my forum with the 2nd model url, it didn't 'fly' to the geo-located model. I had to go back and add a placemark to the model .kml and re-upload it to the Warehouse to get the plugin to 'fly' to the view. I tested this again and sure enough, your code isn't picking up the model's <LookAt> tag. I don't know why this is happening. This really isn't a big issue, because with the plugin in a window in a post, if the user inadvertently zooms out, or navigates away from a model without a placemark, he can 'lose' the model unless he knows exactly where to look for it in the GE 'earth' (A browser refresh would work to 'find' it). A placemark stays visible regardless of zoom level (well, except when zoomed out to planetary view) and so allows the user to find the model and double click it back into to view settings. At any rate, thanks again for all your help and coding work. There's some additional features I want to incorporate into this, but by providing me with the two different versions of code, you've given me comparable codes and that's invaluable for learning how it works. I want to try some of this additional coding myself and I'll get back to you if I have difficulty. I think we can [RD] this now (and I've removed the reference to "Secure HTML/Scripts in Posts" as it's irrelevant) and I think you should add this to the PB code database; it really is a valueable feature addition to PB. If you don't mind, I would like to introduce this code to the Google Earth API community through their forums, as well. I think it's excellent promotion for PB and just as you weren't too familiar with their territory before this, I'm sure most of them would love to see how their work is being adapted to other applications they may not have even thought of yet. When I announce this feature on my forum, I'll be sure to credit you. Thanks again!
|
|