tags:

views:

159

answers:

1

If someone have some experiences with TatukGIS developer kernel product, can you explain how to programmatically save and load layer properties like in their free TatukGIS viewer product?

The environment i use were Delphi 7 and BDS 2006

thanks

Edit, this code don't work:

var
  lyrPeta: TGIS_LayerSHP;
begin
  MapPath:= ExtractFilePath(Application.ExeName) + '\maps\';
  lyrPeta:= TGIS_LayerSHP.Create;
  lyrPeta.Path:= MapPath + 'jabodetabek'+'_asjalan.shp';
  lyrPeta.Name:= 'jabodetabek'+'_asjalan.shp';
  lyrPeta.IgnoreShapeParams:= True;
  lyrPeta.UseConfig:= True;
  lyrPeta.ConfigName:= MapPath + 'jalan.ini';
  lyrPeta.ReadConfig;
  GIS_Viewer.Add(lyrPeta);

+2  A: 

We do this as below in VB6. I think our code was originally based on this FAQ entry. It makes the Tatuk control save an INI file with the layer properties. I believe it automatically reloads the layer properties when the app starts again. If you only want one file, rather than one file per layer, you could try a TTKGP file.

With layer ' the layer is an XGIS_LayerVector '
  .StoreParamsInProject = False
  .ConfigName = "c:\test\mylayer.ini" ' a separate INI file for each layer '
  .WriteConfig
  .SaveAll
End With

EDIT: And loading again - I think this is after the layer has been added to the GIS control.

With layer ' the layer is an XGIS_LayerVector '
  .StoreParamsInProject = False
  .ConfigName = "c:\test\mylayer.ini" ' a separate INI file for each layer '
  .RereadConfig
End With

IMHO the Tatuk help and samples are hard to understand, although the product itself is pretty powerful. It's worth trying the forum for Tatuk questions as well, although you need a support agreement to access it :(

MarkJ
Dels
can you give solution for reading the config by selecting the config file? i have it like in my question, but somehow it can't work
Dels
Have done, I've also added a link to an FAQ page on Tatuk - I *think* our code was originally based on this. http://www.tatukgis.com/faq/question.aspx?show=/faq/store/q10668.htm
MarkJ
thanks again for reply, i'm still evaluating tatukgis (use trial), and we will buy the retail when our project start
Dels
A contractor wrote our Tatuk code for us, and we're now maintaining it. We're fairly happy with the code and the product's powerful, we just struggle to work out how to do anything new. We use the help, samples and forum but still find it difficult. How are you getting on?
MarkJ