Closed GoogleCodeExporter closed 8 years ago
Hi,
I think the issue is that you are possibly resetting the balloon, or else are
reattaching to a feature and clearing its contents.
Also, you don't need the call to OpenFeatureBallon, CreateHtmlStringBalloon
will open automatically if you remove the setBalloon parameter as it defaults
to True.
{{{
KmlHelpers.CreateHtmlStringBalloon(_ge, html: html, feature: kmlFeature);
}}}
If that doesn't work for you then could you post a full example that shows the
problem more clearly?
Thanks.
Original comment by fraser.c...@gmail.com
on 5 Sep 2013 at 1:57
Hi again. Thanks for the reply.
I was calling both CreateHtmlStringBalloon and OpenFeatureBallon as I couldn't
make CreateHtmlStringBalloon work on its own. The balloon is shown, but all
styling is scrubbed. Sorry for not being clear on that.
I've done some more testing, but still cant get CreateHtmlStringBalloon() to
work as expected. However, I've managed to get OpenFeatureBallon to work which
means that I'm probably resetting the features balloon in my other project. I
posted the code below.
Thanks.
private dynamic _ge = null;
int pmCounter = 0;
public Form1()
{
InitializeComponent();
geWebBrowser1.LoadEmbeddedPlugin();
geWebBrowser1.PluginReady += new EventHandler<GEEventArgs>(geWebBrowser1_PluginReady);
geWebBrowser1.KmlEvent += new EventHandler<GEEventArgs>(geWebBrowser1_KmlEvent);
}
void geWebBrowser1_KmlEvent(object sender, GEEventArgs e)
{
e.ApiObject.preventDefault();
dynamic feature = e.ApiObject.getTarget();
/*Can't get CreateHtmlStringBalloon() to work
* Coordinate c = new Coordinate(feature);
KmlHelpers.CreateHtmlStringBalloon(_ge, html: HTMLHelper.CreateHTMLText(c), feature: feature);*/
GEHelpers.OpenFeatureBalloon(_ge, feature, true, setBalloon: true);
}
void geWebBrowser1_PluginReady(object sender, GEEventArgs e)
{
_ge = e.ApiObject;
this.geWebBrowser1.ScriptError += (o, ea) =>
{
MessageBox.Show(ea.Message + ": " + ea.Data, "Script Error");
};
//Add Control(s) to webbrowser
this.kmlTreeView1.SetBrowserInstance(this.geWebBrowser1);
//Move camera to a default lookat
KmlHelpers.CreateLookAt(_ge, 56, 12, altitude: 45000);
}
private void button1_Click(object sender, EventArgs e)
{
var point = GEHelpers.GetCurrentViewAsPoint(_ge);
Coordinate coord = new Coordinate(point);
dynamic pm = KmlHelpers.CreatePlacemark(_ge,
id: "PM " + pmCounter++,
latitude: coord.Latitude,
longitude: coord.Longitude,
name: "Test " + pmCounter,
description: HTMLHelper.CreateHTMLText(),
addFeature: true);
geWebBrowser1.AddEventListener(pm, EventId.Click);
}
private void button2_Click(object sender, EventArgs e)
{
dynamic feature = _ge.getFeatures().getChildNodes().item(0);
//dynamic feature = GEHelpers.GetElementById(_ge, "PM 1");
GEHelpers.OpenFeatureBalloon(_ge, feature, true, setBalloon: true);
}
Original comment by tho...@gmail.com
on 5 Sep 2013 at 7:09
Attachments:
No further development now that the Earth API is depreciated.
Original comment by fraser.c...@gmail.com
on 17 Dec 2014 at 3:20
Original issue reported on code.google.com by
tho...@gmail.com
on 4 Sep 2013 at 4:19