home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / tema / ArcData / www / download / AVPOLY~1.ZIP / AVPoly&Anno.avx next >
Encoding:
Text File  |  1999-04-06  |  3.5 KB  |  46 lines

  1. /3.1
  2. (Extension.1
  3.     Name:    "AVPoly&Anno"
  4.     Dependencies:    "$avbin/avdlog.dll\n"
  5.     FirstRootClassName:    "Butn"
  6.     Roots:    2
  7.     Roots:    4
  8.     Roots:    5
  9.     Roots:    6
  10.     Version:    31
  11.     InstallScript:    4
  12.     UninstallScript:    5
  13.     ExtVersion:    1
  14. )
  15.  
  16. (Butn.2
  17.     Icon:    3
  18.     Click:    "poly&anno3"
  19. )
  20.  
  21. (AVIcon.3
  22.     Name:    "AlignBottom"
  23.     Res:    "Icons.AlignBottom"
  24.  
  25. )
  26.  
  27. (Script.4
  28.     Name:    "AVPoly&AnnoExt.install"
  29.     SourceCode:    "if(av.getproject=nil)then\n return nil\nend\n\nbut = self.get(0)\nviewGUI = av.getproject.findgui(\"view\")\nviewGUI.getbuttonbar.add(but,viewGUI.getbuttonbar.GetControls.count)\nviewGUI.setmodified(true)"
  30. )
  31.  
  32. (Script.5
  33.     Name:    "AVPoly&AnnoExt.uninstall"
  34.     SourceCode:    "if(av.getproject=nil)then\n return nil\nend\n\nif(av.getproject.IsClosing)then\n return nil\nend\n\nav.getproject.findgui(\"view\").getbuttonbar.remove(av.getproject.findgui(\"view\").getbuttonbar.FindByScript(\"poly&anno3\"))"
  35. )
  36.  
  37. (Script.6
  38.     Name:    "poly&anno3"
  39.     SourceCode:    "theView = av.GetActiveDoc\nthemelist = theView.getthemes\npolytheme = msgbox.list(themelist,\"Vyberte polygonovou vrstvu:\",\"\")\nif (polytheme = nil) then return nil end\nif (polytheme.getsrcname.getsubname <> \"polygon\") then\nmsgbox.warning(\"Toto nenφ polygonovß vrstva!\",\"\")\nreturn nil end\n\n'polyftab = polytheme.getftab\n\ndefaultFileName = polytheme.getsrcname.getfilename.GetBaseName \ndefaultFileName = defaultFileName.Left(defaultFileName.Count - 3)\ndefaultFileName = defaultFileName + \"shp\"\n\naFileName = FileDialog
  40. .Put (defaultFileName.AsFileName, \"*.shp\", \"\")\nif (aFileName = nil) then return nil end\n\nif(polytheme.CanExportToFTab) then\n newFtab = polytheme.ExportToFTab (aFileName)\nelse\n msgbox.warning(\"Nelze p°evΘst na shapefile!\",\"\")\nend\n\nannotheme = msgbox.list(themelist,\"Vyberte vrstvu anotacφ:\",\"\")\nif (annotheme = nil) then return nil end\nif (annotheme.getsrcname.getsubname <> \"annotation\") then\n  msgbox.warning(\"Toto nenφ vrstva anotacφ!\",\"\")\n  return nil\nend\n\nannoFTab = annotheme.GetFtab\n\npolyfield = newFtab.Fi
  41. ndField(\"SHAPE\")\nannofield = annoFtab.FindField(\"SHAPE\")\ntextfield = annoFtab.FindField(\"TEXT\")\n\nnewlist = {}\nannolist = {}\n\n't1=date.now\n\nfor each rec in newFtab\nnewlist.Add(newFtab.ReturnValue(polyfield,rec))\nend\n\nfor each rec2 in annoFtab\nannolist.Add({annoFtab.ReturnValue(annofield,rec2),annoFtab.ReturnValue(textfield,rec2)})\nend\n\nif (newFtab.CanEdit) then\n  newFtab.SetEditable(true)\n \n  pcfield = Field.Make (\"parcis\", #FIELD_CHAR, 30, 0)\n  newFtab.AddFields ({pcfield})\n\n  for each l in 0..(newlist.coun
  42. t -1)\n    for each txtlist in annolist\n      if (newlist.Get(l).Contains(txtlist.Get(0))) then\n         newFtab.SetValue(pcfield,l,txtlist.Get(1))\n         annolist.RemoveObj(txtlist)\n         break\n      end\n    end\n  end\n\nq= \"([parcis] = \"\"\"\")\"\nnewFtab.Query(q,newFtab.GetSelection,#VTAB_SELTYPE_NEW)\n\nfor each s in newFtab.GetSelection\npolyshape = newFtab.ReturnValue(polyfield,s)\n  for each txtlist in annolist\n      if (polyshape.Intersects(txtlist.Get(0))) then\n         newFtab.SetValue(pcfield,s,txtlist.
  43. Get(1))\n         'annolist.RemoveObj(txtlist)\n         break\n      end\n  end\nend\nnewFtab.SetEditable(false)\nend\n\n't2 =date.now\n'msgbox.info(((t2-t1).AsSeconds).asstring + \"s\",\"\")\nsouhlas = msgbox.yesno(\"P°idat novΘ tΘma do zobrazenφ?\",\"\",true)\n\nif (souhlas) then\n  thm = theme.make(newFtab.GetSrcName)  \n  theView.AddTheme(thm)\n  thm.setvisible(true)\n  av.GetActiveDoc.Invalidate\nend"
  44. )
  45.  
  46.