Tuesday, July 19, 2011

GTech Loader versions 9.0.0.2 and 10.0.0.2 are Available



GTech Loader versions 9.0.0.2 and 10.0.0.2 are available.

The GTech Loader now supports G/Technology versions 9 and 10. GTech Loader version 9 is for G/Technology version 9 and its relational spatial geometry format while GTech Loader version 10 is for G/Technology version 10 and its Oracle Spatial geometries. Both use the same configuration file format and migrating from one version to the other is trivial.

Both versions of the GTech Loader have an upgraded interface to more closely match GTI's Oracle Spatial Loader's interface.

Version 9.0

-----------
09.00.00.02 - 07/19/11
-----------

- FIX - #6806 - Delete buttons on the Category and Group lists were not clearing the sublists.

- NEW - #6808 - Connection Configuration dialog can now save the current settings to a Connection .ini file used with the command-line mode.

- CHG - #6811 - The Save As toolbar icon was changed to Save. The Save As functionality is now under the File menu.

- NEW - #6812 - MRU List keep the last 5 most recently used files under the File menu.

- NEW - #6813 - Main Dialog is now resizable.

- NEW - #6814 - New and About added to Toolbar.

- NEW - #6815 - File and Help menu added. File includes: Open, Save, Save As, and Exit.

- NEW - #6816 - Cancel button has been added.


-----------
09.00.00.01 - 07/4/11
-----------

- FIX - #6471 - Feature Name was being carried over as Feature Legend Entry name.

- CHG - #6472 - Filter descriptions will now be regenerated the first time the filterId is used for each run.

- FIX - #6494 - Legend leaf node without a parent (level greater than 0) are now included. These items were previously ignored as being invalid.

- FIX - #6521 - Lpad and Rpad functions were not handling the pad string correctly when it contained more than 1 character.

- FIX - #6526 - Expression Evaluator was not handling nested expressions correctly if functions with more than one parameter were used as a parameters.

- CHG - #6528 - Concat function will now support up to 10 parameters.

- FIX - #6534 - Expression containing internal parentheses and commas in literal strings could cause problem with the expression parsing.


Version 10.0

-----------
10.00.00.02 - 07/19/11
-----------

- FIX - #6817 - Fix for loading settings file.

-----------
10.00.00.01 - 07/15/11
-----------

- NEW - #6792 - Support for G/Technology version 10 and Oracle Spatial Geometries.

- NEW - #6793 - Status Listbox has been split into two tabs. One shows the regular status (as in previous verions) and the other shows only errors.

- NEW - #6800 - New and About added to Toolbar.

- NEW - #6801 - File and Help menu added. File includes: Open, Save, Save As, and Exit.

- NEW - #6802 - Main Dialog is now resizable.

- NEW - #6803 - Cancel button has been added to stop a conversion.

- NEW - #6804 - New log file is created with a .error extension that only show errors that occurred during a conversion.

- NEW - #6805 - Delete buttons on the Category and Group lists were not clearing the sublists.

- NEW - #6807 - Connection Configuration dialog can now save the current settings to a Connection .ini file used with the command-line mode.

- NEW - #6809 - MRU List keep the last 5 most recently used files under the File menu.

- CHG - #6810 - The Save As toolbar icon was changed to Save. The Save As functionality is now under the File menu.

Friday, July 15, 2011

GTViewer version 10.0.0.14 is Available



GTViewer version 10.0.0.14 is available.

-----------------------
10.00.00.14 - 07/15/11
-----------------------

- NEW - #6784 - GetCoodinateFactors method added.

- NEW - #6787 - If you set ShowRasterStatus to 1 in the Additional Properties section of the .GTM file, the raster filename will be displayed in the status bar when it is being initialized.

- NEW - #6789 - External Apps using the External Type can now use token as parameters: %cenX%, %cenY%, %zoom

- NEW - #6791 - Rendering Raster message added to status bar.

- FIX - #6794 - Fixes to the Session Links had broken people using then them when session links were not working correctly. Additional logic has been added to work the old way if the new way doesn't find a session link entry.

- NEW - #6797 - Setting added to Options/Settings to prevent multiple RasterPaths from being searched.

- NEW - #6798 - AddLocationHistory method added.

Thursday, July 14, 2011

Creating GTViewer Data with Embedded Data Using FME

In my last post, I covered programmatically embedding data into Session Graphics with GTViewer and GTVx. This post will also cover Embedded Data, but it will use FME to create it instead of VB6 or VB.NET.

The GTViewer Writer Plug-In for FME can easily create embedded data in GTViewer Data. You must expose two Format Attributes in the destination GTViewer Writer: gti_embeddedData and gti_embeddedDataType.

There is currently only 1 valid Embedded Data Type for GTViewer data, so you can set gti_embeddedDataType to a Constant 1. The gti_embeddedData attribute is then set to the string you want to embed. The \t\a\v format for embedded data that I described in the previous post, can also be used here to format the embedded data so that the Attribute Info dialog in GTViewer and GTVx will recognize the embedded data as if it came from a database.

For an example, I will take a TIGER street file and convert it to the GTViewer format. Instead of letting FME create tabular data in the GTViewer format and link it to the graphic elements it creates (which is the default and is usually the desired process), I will delete the tabular attributes from the destination and use only embedded data.


The StringConcatenator transformer (shown above) is used to build the \t\a\v string. There are many ways you could go about building this string in FME, but this approach seemed the easiest and my visual for a blog posting. In the screenshot below, I simply build the embedded data string using constants and attribute values from the TIGER data. One item to note is that the backslash (\) is an escape operator in this FME transformer, so you need to use two backslashes to represent one (\\), and \t becomes \\t, and so on.

You can convert the data to the GTViewer format and open it up in GTViewer. Then review one of the streets:

If you look on the Element Tab for the reviewed street, you will see the Embedded Data property is set to the string we created with FME. Also note that the Attribute Info tab has a red drum indicating that it is Embedded Data instead of Linked Data.

This example is somewhat contrived since if you were really converting street data, you would almost definitely be using Linked data (the default that the GTViewer FME Writer Plug-in provides); however, there are other cases where embedded data might be very useful.



Programmatically Creating Session Graphics with Embedded Data

When drawing session graphics in GTViewer or GTVx, it is very simple to added embedded data. This is also true if you are using the GTDataObjects, the GTV .NET Controls, or GTCreate (but the syntax is slightly different than what I will show in this post).

Creating Session Graphics in GTViewer or GTVx uses a standard process. First set the Drawing Properties to your desired values, then draw the session graphics element (redline) with one of the Draw methods. The newly created session element will use the Drawing Properties you set.

There are two kinds of Drawing Properties that can be set. First, there are the Current Drawing Properties such as Filter Id, Color Id, Style Id, Weight, Fill, and Extended Style. These properties are set with methods like SetCurrentFilterId, SetCurrentColor, SetCurrentStyle, SetCurrentFill, and SetCurrentExtendedStyle. These properties will remember the value you set until you change them. So, you can set your filter id, color, and weight to specific values and all session elements that you create with the Draw methods will use these properties. You can also set these properties before each call to a Draw method if you choose (it will take slightly longer performance-wise if you set every property before each draw, but probably not enough to worry about).

Instance Drawing Properties are the second kind of Drawing Property. These properties will only be applied to the next session graphic created with a Draw method, then they reset themselves to a neutral state. There are really just two Instance Properties: Linkages and Embedded data. Linkages are two 32 bit integer keys on an element that will be automatically be used to look up records in the tabular data. Embedded Data is a string that is embedded on the session graphics element (and the data is available without going to the database and is also portable if you export the session graphics as a .gtg file).

Embedded Data has both a Type value and a string data value. Currently, the Embedded Data Type must always be set to 1. The Embedded Data String value can be any string value (size is not restricted, but their may be practical limits). However, if the string follows a specific format, it will be interpreted as tabular data and will work seamlessly with the Attribute Info functionality in GTViewer and GTVx. This format is called the \t\a\v format. Not a very catchy name, but it is what it is:

{\tTableName{\aAttrName\vValue}} 

You must have one record (table) specified with \t followed by the table name. You then need 1 or more attribute/value pairs where each pair is \a and the attribute’s name followed by \v and the value. In this format notation, the curly braces mean that that the enclosed portion can repeat, so you can have one or more attribute/values pair per table, and you can have one table or more tables. An example is shown below:

\tPole\aPole_Number\v1234\aHeight\v45\aClass\v1

Would represent:

Table: Pole

Attr 1: Pole_Number=1234

Attr 2: Height=45

Attr 3: Class=1

The following VB6 code is for GTViewer. It will create a filled circle in the center of your view and embed some data on it:

Dim cenX As Double
Dim cenY As Double

viewObj.GetViewCenter 1, cenX, cenY

docObj.SetCurrentFill True
docObj.SetCurrentFilterId 0
docObj.SetCurrentColor docObj.GetNearestColor(255, 0, 0)
docObj.DrawSetData 1, "\tMyTable1\aMyAttr1\vMyValue1\aMyAttr2\vmyValue2\tMyTable2\aMyAttr3\vMyValue3\aMyAttr4\vmyValue4"

docObj.DrawCircle32 1, cenX, cenY, 25

viewObj.RefreshView
This code is for GTViewer, but you can swap the viewObj and docObj with GTVX1 and it will work with GTVx as well. The embedded data contains two tables with two attributes on each table, so if you review the circle in GTViewer, it will show you something like this:

There are a few things to note in the above screenshots. First, the Red Drums on the tabs mean the data is Embedded Data and not retrieved from the database (they show as Blue Drums). The Table Names show on the tab. The first table name will show on the right mouse menu when you review one of the session graphics with embedded data. The Element tabs show the first few characters of the embedded data on the Embedded Data line.

The next example uses VB.NET and GTVx to illustrate something a little more realistic than the first example.

Imports GTVXLib
Imports System.Text


Public Class Form1

Dim docObj As AxGTVXLib.AxGTVX
Dim appObj As AxGTVXLib.AxGTVX
Dim viewObj As AxGTVXLib.AxGTVX

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

AxGTVX1.OpenFile("l:\electgasdemo\electgas.gtm")
AxGTVX1.SetHideRaster(1)

docObj = AxGTVX1
viewObj = AxGTVX1
appObj = AxGTVX1

End Sub


Private Sub ButtonPlaceMarker_Click(sender As System.Object, e As System.EventArgs) Handles ButtonPlaceMarker.Click

Dim cenX As Double
Dim cenY As Double

viewObj.GetViewCenter(1, cenX, cenY)

docObj.SetCurrentFill(True)
docObj.SetCurrentFilterId(0)
docObj.SetCurrentColor(docObj.GetNearestColor(255, 0, 0))

Dim data As New StringBuilder

data.Append("\t")
data.Append("Marker")
data.Append("\a")
data.Append("Time")
data.Append("\v")
data.Append(Now.ToLongTimeString)
data.Append("\a")
data.Append("Data")
data.Append("\v")
data.Append(Now.ToLongDateString)
data.Append("\a")
data.Append("User")
data.Append("\v")
data.Append(Environment.GetEnvironmentVariable("USERNAME"))

docObj.DrawSetData(1, data.ToString)

docObj.DrawCircle32(1, cenX, cenY, 25)

viewObj.RefreshView()

End Sub

End Class


The screenshots below show the demo app running after a marker has been placed followed by the Attribute Info dialog you get when reviewing the session graphics.





There are a few items to note in the above demo app. Again the DocObj and ViewObj are just used to simpify moving the code between GTViewer and GTVx. Since these objects are set to the AxGTVX1 object, the same code will work the same in GTVx and GTViewer. I used a StringBuilder to compose my embedded data. You can just as easily use a regular String instead. I think breaking the lines up with the StringBuilder makes it easier to read as well as being theoretically faster when running (versus just using the immutable String type). This example only uses one Table in the embedded data (the first example used 2).

I hope this helps to clarify using embedded data.