Friday, July 24, 2009

Map View vs Application vs Trail Coordinate System

In setting up the iFactor Virtual Earth Connector™ product for a few customers (both actual and evaluation), I have seen the flexible Smallworld projection functionality take more of a front-and-center role for a customer.

Typically customers have set up their SWAF application to use a particular application coordinate system and then they forget about it.

With the VE Connector, rendering can happen in any coordinate system but as you can probably appreciate, the fastest and highest quality rendering can happen if the current map view's coordinate system is the same as the coordinate system that Microsoft's Bing Maps (formerly Virtual Earth) were cached at. So the VE Connector comes with a pre-defined coordinate system (we call it "Virtual Earth") that switches the mapview coordinate system to the same one used by Bing Maps.

Changing the mapview coordinate system has typically caused our customers two "surprises".

The first surprise is that their trail measurements are now different than they used to be. The second surprise is that their application coordinate system is different that it used to be.

Both these "surprises" indicate that the trail coordinate system and the application coordinate system have been "locked" to the mapview coordinate system.

You can change these settings by choosing Tools -> Options from the menu bar.

To change the application coordinate system so that it is always what you want it to be regardless of the current mapview coordinate system, select Geometry Calculations in the Options panel.

To change the trail coordinate system so that it is always what you want it to be regardless of the current mapview coordinate system, select View Defaults in the Options panel and "unlock" the trail coordinate system from the mapivew coordinate system.

That's all there is to it. Remember that changes to the Options panel are typically saved in the ACE so for your changes to be set for all users, you will need to take the usual steps involved with propagating ACE changes down the ACE alternative structure.

Thursday, July 23, 2009

Simplifying Complex Code

I saw an example in code today that cried for simplifaction. Actually, it reminded me of the first piece of code I had reviewed by someone in Cambridge and it got hacked to pieces. It was a bit hard to swallow, but that kind of feedback definitely helped me in the long run.

So here is the perfectly logical, but unnecessarily complex piece of code...

_method cit_circuit.is_bearer?
l_bearer? << _if _self.cit_circuit_type.code = "Bearer"
_then >> _true
_else >> _false
>> l_bearer?


... which can be greatly simplified to...

_method cit_circuit.is_bearer?

_return _self.cit_circuit_type.code = "Bearer"


Any time you see an if/then/else block of code that returns a boolean that should raise a red flag for you that your code structure is too complex.