Q&A - Question

Style ini file icons

Question
FabD asked on February 10, 2017, keyword: Developer Kernel
Hi.
I've created some style INI files using TatukGIS viewer (right click on the layer in the legend and "Save layer properties..."). Then I want to use those INI files to apply the style to some layers in my application developed using TatukGIS DK .NET (C#).
My layers are instances of the TGIS_LayerSqlPgisLibpq class. To apply the style from the ini file I read the content of the file and I set it to the layer using the ApplyStyle() method. It works, but I have only a problem with the icons, that are not displayed.

Example of INI file:

[TatukGIS Layer]
Ground=OnDem
Legend=generic
Marker.Color=$10101
Marker.ShowLegend=YES
Marker.SmartSize=16
Marker.Style=CIRCLE
Query=water_lev IS NULL
Visible=YES

[TatukGIS Layer 1]
Ground=OnDem
Legend=w2
Marker.Color=$10101
Marker.SmartSize=15
Marker.Style=BOX
Marker.Symbol=C:\styles\icons\w2.svg
Query=water_lev = 2
Visible=YES

In this case the items that match the [TatukGIS Layer 1] condition are not displayed, it seems that the svg file is not loaded. This appens every time there is an external icons file. If I load the same file in TatukViewer, it works.

Thank you
Answers
FabD replied January 12, 2017
Sorry I've made some other test and I found that the problem is not in the icon files.

The problem is that only the items that match the first condition are displayed. The other items are not visible.
Tomasz Kosinski (TatukGIS) replied January 12, 2017
Hi,
Ini is for a single layer only . So [TatukGIS Layer 1] will be ignored
FabD replied January 13, 2017
Thank you for your answer.
Anyway it seems that the style is loaded correctly, but for some reason only the items that match with the first condition are drawn.

So I've tried to set the parameters manually (I want to draw the items with different styles depending on the value of a field). This is my code:

layer.Params.Query = "water_lev IS NULL";
layer.Params.Marker.Color = System.Drawing.Color.Black;
layer.ParamsList.Add();
layer.ParamsList.Selected = 1;
layer.Params.Query = "water_lev IS NOT NULL";
layer.Params.Marker.Color = System.Drawing.Color.Blue;
layer.Params.Visible = true;

In this way I expect that the items with water_lev = NULL are black and the others are blue. Instead only the items with water_lev = NULL are drawn, the others are hidden.

Then, how can I set different styles depending on the fields value?
FabD replied January 13, 2017
I think I've solved my problem.

The issue was that I set the Params values before adding the layer to the map. It seems that the Params added are deleted when the layer is added to the map.
If I set the Params after adding the layer to the map, it works.
Danv replied February 10, 2017
I use this methodology:

I setup the layer in either the viewer or Editor. Then I save the properties using the standard function using the right mouse click in the legend.

Then I use this to reload the layer properties.


<FONT COLOR="blue"> procedure <FONT> btnOpenConfigClick(Sender: TObject);                                              
var                   
    l_filename : string;        
    l_name : string;
    l_length : integer;    
begin       
    l_filename := FileListBox1.FileName;                                  
    if not Assigned(LAYER) then exit;  
    LAYER.ParamsList.Clear;
    LAYER.ParamsList.ClearAndSetDefaults;  
    LAYER.ParamsList.LoadFromFile(l_filename);    
    GIS.Update;
   
    SetLayerCaption(l_filename);
    
    GIS_Legend.Update;                      
end;


This is part of our module for setting up a theme library. You can then switch very fast from one theme to another.
If you would like to answer the question please Sign In.
*
*
Please review our recent Privacy Policy.
If you have any questions or requests, please contact us.
Rules
The Questions and Answers (Q & A) is intended to provide a means of communication between TatukGIS customers.
 
  1. Licensed users (with active maintenance play) of TatukGIS products may contribute to the Q & A content. Read-only access is available to anyone.
  2. Keep the content positive and professional.
  3. Be courteous to others by posting information when a question or issue asked on the Q & A is answered or resolved by other means (such as with help from TatukGIS technical support). Offer others at least a hint how the posted question was answered or the issue was resolved.
  4. The Q & A is not a replacement for TatukGIS technical support. TatukGIS team may or may not regularly follow or contribute content.