Seçilen Nesneye Zoom Yapma

Bir sorgu sonucu seçilen nesneye zoom yapmak için aşağıdaki MapBasic kodu kullanılabilir. Zoom yapılacak nesne bir nokta ise kullanılacak zoom değeri (harita genişliği) parametrik olarak ayarlanabilir:

include "mapbasic.def"

declare sub main
declare sub ZoomToSelection (byval mapWidth as integer)

sub main
  call ZoomToSelection(1000)
end sub

sub ZoomToSelection (byval mapWidth as integer)
  if SelectionInfo(3) = 0 then 'Seçili nesne yoksa mesaj verip çık
    note "Seçili nesne yok."
    exit sub
  end if
  if SelectionInfo(3) = 1 then 'Tek nesne seçili
    if TableInfo(SelectionInfo(1), TAB_INFO_MAPPABLE) then
      if Str$(Selection.obj) = "Point" then 'Seçili nesne bir nokta nesnesi
        set map zoom mapWidth units "m"
      end if
    else 'Seçili kayda ait harita nesnesi yoksa çık
      exit sub
    end if
  end if
  add map layer Selection
  set map zoom entire layer 1
  remove map layer 1
end sub

 

Bir sorgu sonucu seçilen nesneye zoom yapmak için aşağıdaki MapBasic kodu kullanılabilir. Zoom yapılacak nesne bir nokta ise kullanılacak zoom değeri (harita genişliği) parametrik olarak ayarlanabilir:

include “mapbasic.def”

declare sub main

declare sub ZoomToSelection (byval mapWidth as integer)

sub main

call ZoomToSelection(1000)

end sub

sub ZoomToSelection (byval mapWidth as integer)

if SelectionInfo(3) = 0 then ‘Seçili nesne yoksa mesaj verip çık

note “Seçili nesne yok.”

exit sub

end if

if SelectionInfo(3) = 1 then ‘Tek nesne seçili

if TableInfo(SelectionInfo(1), TAB_INFO_MAPPABLE) then

if Str$(Selection.obj) = “Point” then ‘Seçili nesne bir nokta nesnesi

set map zoom mapWidth units “m”

end if

else ‘Seçili kayda ait harita nesnesi yoksa çık

exit sub

end if

end if

add map layer Selection

set map zoom entire layer 1

remove map layer 1

end sub

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment