At the 2009 AGI User's Conference, we demonstrated new technology that allows Insight3D applications to be deployed over the web. While we are rolling out the new technology, you can still get started building a web application with a version of Insight3D that is available today. Because Insight3D is a .NET library, it is easy to develop and deploy your applications over the web so that they can be run in virtually any web browser on the Windows platform, and even in browser-enabled applications, like Google Earth. In the first part of this blog series, I’ll take you through the basics of getting started developing an Insight3D web application for deployment on your intranet.
While there are various technologies that allow for Insight3D to be run in a web browser, we are going to focus on a particular one in this entry: XAML Browser Applications (or XBAPs.) There are many advantages to XBAPs over other web technologies.
For instance, deployment is simplified through Microsoft ClickOnce, allowing any prerequisites for a web application to be pushed out over your intranet or installed with a simple client side installer. Insight3D, in the form of a client side plug-in installer, is only 12 megabytes. The experience is also clean for your end users – there is no information bar or security warnings when the web application is run; clients can click on an html link and be interacting with a full Insight3D application in their web browser in seconds. Also, once the plug-in is installed, XBAPs allows you to update your application logic and push out the updates to your hosting server. When clients connect to your Insight3D web application, the update is automatically deployed without any further install, and the transition to newer versions of your application is completely transparent to your clients.
To get started, let’s create a new XBAP project. Create a new project in Microsoft Visual Studio and select the WPF Browser Application template under the language of your choice. WPF Browser Application projects are available starting with the .NET 3.0 framework. In this walk-through, we’ll build our web application using C#, as seen below.
In your project references, add references to the AGI.Foundation.Graphics and AGI.Foundation.Core assemblies, which can be found in the Assemblies directory of your AGI Components install location. In addition, since we will be hosting the Windows Forms based Insight3D control in our web application, add references to the .NET assemblies WindowsFormsIntegration and System.Windows.Forms.
We will also configure the ClickOnce Security Settings for our XBAP project. Since this walkthrough is for intranet deployment, in the project properties, navigate to the Security category and select the “This is a full trust application” option, as seen below:
Next, let's add the Insight3D control. Open the XAML text editor for Page1.xaml, and add the two lines shown below. As you type the code for the second line, an event handler should be added to your application to notify us when the page hosting our application has loaded:
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" Loaded="Page_Loaded"
Also, let's add a DockPanel container to hold the WindowsFormsHost that will host our Insight3D control:
<DockPanel>
<my:WindowsFormsHost DockPanel.Dock="Top" Name="Insight3DHost"/>
</DockPanel>
Your final Page1.xaml code will look similar to:
<Page x:Class="Insight3DWebApplication.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
Loaded="Page_Loaded"
Title="Page1">
<DockPanel>
<my:WindowsFormsHost DockPanel.Dock="Top" Name="Insight3DHost"/>
</DockPanel>
</Page>
Next, open Page1.xaml.cs and add a member for the Insight3D control to the Page1 class as follows:
AGI.Foundation.Graphics.Insight3D Insight3D = null;
We will instantiate the Insight3D control when the page loads, so add the following two lines to the Page_Loaded event handler:
Insight3D = new AGI.Foundation.Graphics.Insight3D(); Insight3DHost.Child = Insight3D;
Finally, since we will eventually be deploying our application over the web, we need to activate the appropriate license. We can add a static constructor to our Page1 class, and then call the ActivateLicense method with a string containing the contents of our .lic file:
public partial class Page1 : Page
{
AGI.Foundation.Graphics.Insight3D Insight3D = null;
static Page1()
{
AGI.Foundation.Licensing.ActivateLicense(
@"Copy and paste the contents of your .lic file here");
}
public Page1()
{
InitializeComponent();
}
private void Page_Loaded(object sender, RoutedEventArgs e)
{
Insight3D = new AGI.Foundation.Graphics.Insight3D();
Insight3DHost.Child = Insight3D;
}
}
At this point, when you run your project, you should see the Insight3D globe running in a web browser. You can continue to develop your web application as you would a normal Insight3D application.
In future parts of this series, I will discuss deployment and security, upcoming improvements to our web technology, and how to make your Insight3D web application run in virtually any browser on Windows.
mbartholomew good dia,gostaria of your help, am of the brazil and tou with poblema in the installation of my satellite antenna because the soft that I used p / to install is not updated that is the google earth I don’t find the satellite that I should point my antenna that the satellite amazon.therefore I ask for kindness if it was able to me to send me for email the soft of the agio with the license and everything those that he/she has the satellites geostacionarios because they are updated and I would find the satellite that I want.ok at once thank….it was worth EMAIL;RAITO07@HOTMAIL.COM
What if i need to add WPF content over your control? let say I want to add WPF control buttons on top of the insight3D control, there are some airspace issues that causes flickering. Is there another way to embed the insight3D control in a WPF app?
Udi,
Currently, because of the way WPF and Insight3D are rendered, flickering can occur when WPF content is layered directly on top of the Insight3D control. This should not occur with WPF content that is positioned outside the control bounds. We are currently working on a WPF version of the Insight3D control that avoids this issue altogether.
As an alternative, you can stream a control’s visual state to a TextureScreenOverlay using a RasterStream and Control.DrawToBitmap (WinForms) or the RenderTargetBitmap class (WPF). For interactivity, this usually requires some event/message forwarding schema at the ScreenOverlay picking level. We will consider providing example code for achieving this functionality in a future release.
Hi mbartholomew,
Tnx for your replay,
Your suggestion is indeed doable, unfortunatly, will suffer poor performance due to the RenderTargetBitmap costly operation (I have some relatively heavy graphics to run on top of the Insight3D control).
What is the supposed due time for the new Insight3D? Will it replace the current one?
Udi,
The WPF control will likely be supplementary to the WinForms control. The release cycle for AGI Components is typically once a month, so you can expect enhancements in a reasonable time period.
Also, it may be worth noting that you can visit the Insight3D forums for additional information and answers, or contact the Insight3D team directly. The link to our support page is below:
http://www.insight3d.com/support/