Q&A - Question

Is a shape visible at a certain scale?

Question
Danv asked on October 05, 2020, keyword: Developer Kernel
Layers can be setup to be shown at certain scales.
The layers is however always active in the legend.

So how can I ask if data of a layer is visible/drawn at a certain scale?

I would like to know something like:

l_shape.VisibleAtScale(GIS.Scale) or
l_shape.VisibleAtScale('1:500')

or on layer level

l_visible is a boolean
l_visible := l_layer.ShapesVisibleAtScale('1:500')

Is there something like that in the DK?
Answers
Tomasz Kosinski (TatukGIS) replied October 05, 2020

Hi,
There is nothing specific, but take a look at this snippet:

var
  i   : Integer ;
  la  : TGIS_Layer ;
  vis : Boolean ;
begin
  la := TGIS_Layer( GIS.Items[0] ) ;

  vis := False ;
  for i:=0 to la.ParamsList.Count - 1 do begin

    if ( la.ParamsList[i].Visible = False ) or
       ( GIS.ScaleAsFloat < la.ParamsList[i].MinScale ) or
       ( GIS.ScaleAsFloat > la.ParamsList[i].MaxScale )
    then
      continue ;

    vis := True ;
    break ;
  end;
end;
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.