Getting Started with GISforTT

If you already have Visual Studio 2010 installed, you only need to download the latest API version from the source code page.
You can find an overview of the user interface features provided by the API here.

Start Developing:

After downloading the API, run Visual Studio 2010 and open the API Visual studio solution. Compile the solution to generate the dlls of the API. Then create your own solution and project by opening the new projects dialog box. Create a WPF application and add the dlls of the API to the references folder of the new project. The dlls you may need are found in this folder:

GISforTT_API\bin\Debug

The main dll of the API is GISforTT_API.dll. In addition to this dll, you will find dlls of the Touch Toolkit, Surface Toolkit and the ESRI ArcGIS API. As an alternative to adding the API's .dll files, you can create a new WPF project within the GISforTT solution, make your project the startup project, and add GISforTT_API as a project reference.

In the GISforTT project, you will find an example application called eGrid. In this application you can find more examples of how to use the API and some more advanced features. Your new project will have a MainWindow.xaml and its associated MainWindow.xaml.cs. In the .xaml file make sure to define a canvas (rather than a grid). For example:

<Window x:Class="SampleApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow">

    <Canvas Name="LayoutRoot" Background="White"/>
    
</Window>


Feel free to define all the widgets that you will add to your application.

In the .xaml.cs file, remember to include the API:

using GISforTT_API;

In the constructor of the MainWindow, define a Loaded event handler, as follows:

public MainWindow()
{
   InitializeComponent();

   this.Width = System.Windows.SystemParameters.VirtualScreenWidth;
   this.Height = System.Windows.SystemParameters.VirtualScreenHeight;
   this.Left = 0;
   this.Top = 0;
   this.ResizeMode = ResizeMode.NoResize;
            
   this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
}


In the event handler you can define the GIS interface manager of the API and customize any other interface features. The following is an example and you can find details about customizations in the links below.

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
   GisInterfaceMgr bgm = GisInterfaceMgr.Instance;
   bgm.setMainWindow(this);
   bgm.setOrientation(Orientation.Horizontal);

   // Map Layers
   List<MapLayerDef> defaultMapLayers = new List<MapLayerDef>();
   defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.SatelliteImagery));
   defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OnlinePublishedMap, "NewPublishedLayer", 
              "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer"));
   defaultMapLayers.Add(new MapLayerDef(MapLayerDef.MapLayerType.OfflineAnnotationLayer));

   bgm.setDefaultMapLayerTypes(defaultMapLayers);
   
   // Add GisInterfaceMgr object to the interface
   LayoutRoot.Children.Add(bgm);           
}


Customize the Interface

Last edited Jul 11, 2011 at 10:06 PM by ealafselim, version 22

Comments

No comments yet.