/3.1 (Extension.1 Name: "СonvertThemes" FirstRootClassName: "AVDLog" Roots: 2 Roots: 58 Roots: 59 Roots: 60 Roots: 61 Version: 31 UnloadScript: 62 InstallScript: 63 ) (AVDLog.2 Name: "conv" X: 109 Y: 145 W: 572 H: 308 ConstrainedControlNames: 3 ConstrainedControlNames: 4 Constraints: 5 Constraints: 6 Server: 7 ControlPanel: 8 Title: "Конвертирование тем" EscapeEnabled: 1 Resizable: 1 AlwaysOnTop: 1 HasTitleBar: 1 Closeable: 1 DefaultButton: 57 ) (AVStr.3 S: "aLabelButton1" ) (AVStr.4 S: "aLabelButton3" ) (Numb.5 N: 85.00000000000000 ) (Numb.6 N: 85.00000000000000 ) (Nil.7 ) (CPanel.8 Child: 9 ResBox: 56 Listening: 1 ) (CPanel.9 InternalName: "ListOfThemes" Child: 10 Child: 11 Child: 12 Child: 17 Child: 18 Child: 23 Child: 28 Child: 33 Child: 38 Child: 43 Constraints: 0x55 ResBox: 46 ResBox: 47 ResBox: 48 ResBox: 49 ResBox: 50 ResBox: 51 ResBox: 52 ResBox: 53 ResBox: 54 ResBox: 55 Label: "\n" VisibleBorder: 1 Listening: 1 ) (LButn.10 InternalName: "aLabelButton1" Label: "Выход" Click: "Conv.CloseDialog" ) (LButn.11 InternalName: "aLabelButton3" Label: "Пуск" Click: "Conv.MakeConv" ) (CPanel.12 InternalName: "aControlPanel4" Child: 13 Child: 14 Constraints: 0x55 ResBox: 15 ResBox: 16 Label: "Темы" VisibleBorder: 1 Listening: 1 ) (RButn.13 InternalName: "aAct1" Constraints: 0x55 Listening: 1 Label: "Активные темы " ) (RButn.14 InternalName: "aAct" Constraints: 0x55 Listening: 1 Label: "Все темы" ) (RectD.15 Left: 11.00000000000000 Top: 56.00000000000000 Right: 190.00000000000000 Bottom: 29.00000000000000 ) (RectD.16 Left: 11.00000000000000 Top: 39.00000000000000 Right: 138.00000000000000 Bottom: 12.00000000000000 ) (TextLabel.17 InternalName: "aTextLabel7" Constraints: 0x55 Label: "Выбор View" Listening: 1 ) (CPanel.18 InternalName: "aControlPanel1" Child: 19 Child: 20 Constraints: 0x55 ResBox: 21 ResBox: 22 Label: "Записать легенды?" VisibleBorder: 1 Listening: 1 ) (RButn.19 InternalName: "LegYes" Constraints: 0x55 Listening: 1 Label: "Да" ) (RButn.20 InternalName: "LegNo" Constraints: 0x55 Listening: 1 Label: "Нет" ) (RectD.21 Left: 10.00000000000000 Top: 40.00000000000000 Right: 137.00000000000000 Bottom: 13.00000000000000 ) (RectD.22 Left: 10.00000000000000 Top: 56.00000000000000 Right: 137.00000000000000 Bottom: 29.00000000000000 ) (CPanel.23 InternalName: "aControlPanel2" Child: 24 Child: 25 Constraints: 0x55 ResBox: 26 ResBox: 27 Label: "Снять фильтры тем?" VisibleBorder: 1 Listening: 1 ) (RButn.24 InternalName: "DefYes" Constraints: 0x55 Listening: 1 Label: "Да" ) (RButn.25 InternalName: "DefNo" Constraints: 0x55 Listening: 1 Label: "Нет" ) (RectD.26 Left: 9.00000000000000 Top: 39.00000000000000 Right: 136.00000000000000 Bottom: 12.00000000000000 ) (RectD.27 Left: 9.00000000000000 Top: 56.00000000000000 Right: 136.00000000000000 Bottom: 29.00000000000000 ) (CPanel.28 InternalName: "aControlPanel3" Child: 29 Child: 30 Constraints: 0x55 ResBox: 31 ResBox: 32 Label: "Снять выделение тем?" VisibleBorder: 1 Listening: 1 ) (RButn.29 InternalName: "VidNo" Constraints: 0x55 Listening: 1 Label: "Нет" ) (RButn.30 InternalName: "VidYes" Constraints: 0x55 Listening: 1 Label: "Да" ) (RectD.31 Left: 9.00000000000000 Top: 54.00000000000000 Right: 136.00000000000000 Bottom: 27.00000000000000 ) (RectD.32 Left: 9.00000000000000 Top: 37.00000000000000 Right: 136.00000000000000 Bottom: 10.00000000000000 ) (CPanel.33 InternalName: "aControlPanel12" Child: 34 Child: 35 Constraints: 0x55 ResBox: 36 ResBox: 37 Label: "Режим работы" VisibleBorder: 1 Listening: 1 ) (RButn.34 InternalName: "rezh2" Constraints: 0x55 Listening: 1 Label: "Проверять каждое название" ) (RButn.35 InternalName: "rezh1" Constraints: 0x55 Listening: 1 Label: "В автоматическом режиме" ) (RectD.36 Left: 10.00000000000000 Top: 56.00000000000000 Right: 238.00000000000000 Bottom: 29.00000000000000 ) (RectD.37 Left: 10.00000000000000 Top: 39.00000000000000 Right: 227.00000000000000 Bottom: 12.00000000000000 ) (CPanel.38 InternalName: "aControlPanel15" Child: 39 Child: 40 Constraints: 0x55 ResBox: 41 ResBox: 42 Label: "Задать названия новых тем как:" VisibleBorder: 1 Listening: 1 ) (RButn.39 InternalName: "name2" Constraints: 0x55 Listening: 1 Label: "Название темы" ) (RButn.40 InternalName: "name1" Constraints: 0x55 Listening: 1 Label: "Название файла" ) (RectD.41 Left: 10.00000000000000 Top: 56.00000000000000 Right: 238.00000000000000 Bottom: 29.00000000000000 ) (RectD.42 Left: 10.00000000000000 Top: 39.00000000000000 Right: 227.00000000000000 Bottom: 12.00000000000000 ) (AVLBox.43 InternalName: "VList" NextControl: 7 ContentKind: 4 Value: 44 Constraints: 0x55 ColumnCount: 1 HorizontalScroll: 1 Listening: 1 VerticalScroll: 1 SelectionStyle: 45 ) (AVStr.44 S: "" ) (AVEnum.45 Name: "LISTBOX_SELECTION_SINGLECELL" ) (RectD.46 Left: 289.00000000000000 Top: 273.00000000000000 Right: 395.00000000000000 Bottom: 252.00000000000000 ) (RectD.47 Left: 161.00000000000000 Top: 274.00000000000000 Right: 259.00000000000000 Bottom: 252.00000000000000 ) (RectD.48 Left: 21.00000000000000 Top: 64.00000000000000 Right: 243.00000000000000 Bottom: 10.00000000000000 ) (RectD.49 Left: 266.00000000000000 Top: 140.00000000000000 Right: 540.00000000000000 Bottom: 120.00000000000000 ) (RectD.50 Left: 21.00000000000000 Top: 118.00000000000000 Right: 243.00000000000000 Bottom: 64.00000000000000 ) (RectD.51 Left: 22.00000000000000 Top: 173.00000000000000 Right: 244.00000000000000 Bottom: 119.00000000000000 ) (RectD.52 Left: 22.00000000000000 Top: 230.00000000000000 Right: 244.00000000000000 Bottom: 176.00000000000000 ) (RectD.53 Left: 266.00000000000000 Top: 63.00000000000000 Right: 513.00000000000000 Bottom: 9.00000000000000 ) (RectD.54 Left: 266.00000000000000 Top: 118.00000000000000 Right: 513.00000000000000 Bottom: 64.00000000000000 ) (RectD.55 Left: 270.00000000000000 Top: 229.00000000000000 Right: 530.00000000000000 Bottom: 142.00000000000000 ) (RectD.56 Left: 12.00000000000000 Top: 304.00000000000000 Right: 566.00000000000000 Bottom: 5.00000000000000 ) (Nil.57 ) (Script.58 Name: "conv.CloseDialog" SourceCode: "TheDialog = av.FindDialog(\"conv\")\n\nthedialog.Close\n" ) (Script.59 Name: "conv.Makeconv" SourceCode: "theView=av.GetActiveDoc\nTheDialog = av.FindDialog(\"conv\")\naddToView = TheDialog.FindByName(\"VList\").GetCurrentValue \n\n\naAct = TheDialog.FindByName(\"aAct\") \naAct1 = TheDialog.FindByName(\"aAct1\") \nLegYes = TheDialog.FindByName(\"LegYes\") \nLegNo = TheDialog.FindByName(\"LegNo\") \nDefYes = TheDialog.FindByName(\"DefYes\") \nDefNo = TheDialog.FindByName(\"DefNo\") \nvidYes = TheDialog.FindByName(\"vidYes\") \nvidNo = TheDialog.FindByName(\"vidNo\") \nRezh1 = TheDialog.FindByName(\"Rezh1\") \nRezh2 = TheDialog.FindByName(\"Rezh2\") \nname1 = TheDialog.FindByName(\"name1\") \nname2 = TheDialog.FindByName(\"name2\") \n\n'Конвертирование тем\n\ntheProjection=theview.Getprojection \ntheUnits = TheView.GetUnits\nTheScale = TheView.ReturnScale\ntheDisplay=theView.GetDisplay\ntheExtent = theDisplay.ReturnExtent\ntheCenter = theExtent.ReturnCenter\n\n'ThemeList={\"Все темы\", \"Активные темы\"}\n'ClassTheme = msgbox.ChoiceAsString(ThemeList,\"Конвертировать темы:\",\"Выбор списка тем\")\nnView = False\n'AvlList={\"Да\", \"Нет\"}\n'ClassAvl = msgbox.ChoiceAsString(AvlList,\"За писать легенды?\",\"Добавление легенд\")\n\n\n\n if (aAct.IsSelected = True) then\n TheListTheme = theView.GetThemes\n else\n TheListTheme = theView.GetActiveThemes\n end \n\n'ClearList={\"Да\", \"Нет\"} 'Снимаем выделение, если надо\n'ClassClear = msgbox.ChoiceAsString(ClearList,\"Снять выделение тем?\",\"Выделение темы\")\n\n'DifList={\"Да\", \"Нет\"} 'Снимаем difinition, если надо\n'ClassDif = msgbox.ChoiceAsString(ClearList,\"Снять выборку тем?\",\"difinition\")\n\n \n TheListTheme1 = List.Make\n\nFor each i in TheListTh eme\n TheListTheme1.Insert(i)\nend\n\n' RezhimList={\"В автоматическом режиме\", \"Проверять каждое название\"}\n' ClassRezhim = msgbox.ChoiceAsString(RezhimList,\"Режим работы:\",\"Проверка названий покрытий\")\n\n if (Rezh1.IsSelected = True) then\n mDirName = msgbox.Input(\"ПРОВЕРЬТЕ НАЛИЧИЕ КАТАЛОГА!\",\"Укажите директорию для новых покрытий\",\"c:\\\")\n end\n\n'' Create a list of views and allow the user to choose which view to\n' viewList = {}\n' for each d in av.GetProject.GetDocs\n' if (d.Is(View)) then\n' viewList .Add( d )\n' end\n' end\n'' Include a choice for a new view...\n' viewList.Add(\"\")\n' addToView = MsgBox.ListAsString( viewList,\"Добавить темы:\", \"Выбор View\" ) \n' Get the specified view, make the theme, and add it... if (addToView <> nil) then\n if (addToView = \"\") then\n nView = true\n addToView = View.Make\n addToView.GetWin.Open\n end\n ' see if the view is projected\n thePrj = theView.GetProjection\n if (thePrj.IsNull.Not) then\n p = MsgBox.YesNoCancel(\"Ar cView has detected that your view is projected.\"++\n \"Do you want the new shapefile to be saved in the projected units?\",\n \"convert\", FALSE)\n if (p = Nil) then return nil end\n end\n\n 'NameList={\"Название файла\", \"Название темы\"}\n 'ClassName = msgbox.ChoiceAsString(NameList,\"Задать название новых тем как:\",\"Названия тем\")\n\n\n TheGraphicList = addToView.GetGraphics\n NewDisplay = addToView.GetDisplay\n \n ' for each i in TheGraphicList\n ' i.IsSelected(FALSE)\n ' end\n\n GrList = {}\n \n'+ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++=\n for each t in TheListTheme1\n If (vidYes.IsSelected = True) then\n t.ClearSelection\n end \n If (defYes.IsSelected = True) then\n t.GetFTab.SetDefinition(\"\")\n end \n\n p = FALSE\n\n TheDef = t.GetFTab.GetDefinition \n theLegend = t.GetLegend\n TheThemeGraphic = t.GetGraphics\n theVis = t.IsVisible\n 'NewGraphics = TheGraphics.Clone\n For each i in TheThemeGraphic\n newLabel = i.Clone\n GrList.Add(newLabel)\n End\n \n outFN ameTheme=t.GetName\n outFNameTable=t.GetFTab.GetName\n\n\n\n \n\n if (Rezh2.IsSelected = True) then\n If (Name1.IsSelected = True) then\n outFName = outFNameTable\n pI = outFName.AsString.Indexof(\".\")\n outFNameTab = outFName.AsString.Left(pI)\n outFNameTH=outFName.AsString.Left(pI)+\".shp\"\n outFNameTH = outFNameTH.AsFileName\n def = FileDialog.Put(outFNameTH, \"*.shp\", \"convert \" + outFNameTab.AsString)\n pInew = def.AsString.Indexof(\".\")\n outFNameTHnew=def.AsString.Le ft(pInew)\n outFNameTHnew = outFNameTHnew.AsFileName\n\n if (legYes.IsSelected = True) then\n outFNameAVL=outFNameTHnew.AsString +\".avl\"\n outFNameAVL = outFNameAVL.AsFileName\n defleg = FileDialog.Put(outFNameAVL, \"*.avl\", \"Создание легенды темы \" + outFNameTab.ASString)\n end \n\n else\n outFName = outFNameTheme\n 'pI = outFName.AsString.Indexof(\".\")\n outFNameTH=outFName.AsString+\".shp\"\n outFNameTH = outFNameTH.AsFileName\n def = FileDialog.P ut(outFNameTH, \"*.shp\", \"convert \" + outFName.AsString)\n pInew = def.AsString.Indexof(\".\")\n outFNameTHnew=def.AsString.Left(pInew)\n outFNameTHnew = outFNameTHnew.AsFileName\n \n if (LegYes.IsSelected = True) then\n outFNameAVL=outFNameTHnew.AsString+\".avl\"\n outFNameAVL = outFNameAVL.AsFileName\n defleg = FileDialog.Put(outFNameAVL, \"*.avl\", \"Создание легенды темы \" + outFName.ASString)\n end \n \n end \n \n else\n If (name1.IsSelecte d = True) then\n outFName = outFNameTable\n else\n outFName = outFNameTheme\n End \n pI = outFName.AsString.Indexof(\".\")\n\n def = mDirName+\"\\\"+outFName.AsString\n def = def.AsFileName\n if (LegYes.IsSelected = True) then\n If (pI>0) then\n outFNameAVL=outFName.AsString.Left(pI)\n else\n outFNameAVL=outFName.AsString\n end \n \n 'outFNameAVL = outFNameAVL.AsFileName\n defleg = mDirName+\"\\\"+outFNameAVL+\".avl\"\n defleg = defleg.AsFileName\n end \n end \n \n if (LegYes.IsSelected = True) then\n theLegend.Save(defleg)\n end\n \n if (t.Is( FTHEME ).Not) then \n if (t.CanExportToFtab.Not) then continue end\n \n if (def = NIL) then return NIL end\n anFTab = t.ExportToFtab(def)\n \n ' For Database themes, which can return a nil FTab sometimes \n if (anFTab=nil) then\n MsgBox.Warning(\"Error occurred while converting to shapefile.\"+NL+\n \"Shapefile was not created.\", \"convert \" + t.getNam e)\n continue\n end \n\n shpfld = anFTab.FindField(\"Shape\")\n \n else\n \n tbl = t.GetFTab\n attribVis = FALSE\n for each f in tbl.GetFields\n if ((f.IsVisible) and not (f.IsTypeShape)) then\n attribVis = TRUE\n break\n end\n end\n shapeVis = tbl.FindField(\"Shape\").IsVisible\n if ((attribVis and shapeVis).Not) then\n continue\n end\n \n \n if (def = NIL) then return nil end\n \n shpfld = (tbl.FindField(\"Shape\"))\n if (shpfld.IsVisible.Not) then\n shpfld.SetVisible(shpfld.IsVisible.Not)\n WasNotVisible = TRUE\n else\n WasNotVisible = FALSE\n end\n \n \n ' if the user wants to project the shape, use ExportProjected\n if (p) then\n anFTab = tbl.ExportProjected(def, thePrj, tbl.GetSelection.Count > 0)\n else\n anFTab = tbl.Export(def, Shape, tbl.GetSelection.Count > 0)\n end\n \n if (anFTab.HasError) then\n if (anFTab.HasLockError) then\n MsgBox.Error(\"Unable to acquire Write Lock for file \" +\n def .GetBaseName,\"\")\n else\n MsgBox.Error(\"Unable to create \" + def.GetBaseName,\"\")\n end\n return nil\n end\n \n if (WasNotVisible) then\n shpfld.SetVisible(FALSE)\n end\n \n end\n\n ' build the spatial index\n anFTab.CreateIndex(shpfld)\n\n\n'+++++++++++++++++++++++++++++++++++++++++++++++++++++ \n\n ' add the new theme to... \n \n fthm = FTheme.Make(anFTab)\n addToView.AddTheme( fthm )\n fthm.SetLegend(thelegend)\n fthm.SetName(t.GetName)\n If (defno.IsSelected = True) then\n fthm. GetFTab.SetDefinition(TheDef) \n end\n For each j in GrList\n 'j.SetObjectTag(t.GetName.AsString)\n TheGraphicList.Add(j)\n End\n\n 'For each i in TheGraphicList\n ' graphname=i.GetObjectTag\n ' if (graphname = t.GetName.AsString) then\n ' i.SetSelected( TRUE )\n ' end\n ' end \nfthm.GetGraphics.Merge(GrList)\nfthm.GetGraphics.SetVisible(fthm.IsVisible)\nfthm.GetGraphics.Invalidate \nfthm.SetVisible(TheVis)\n\n'if (ClassProp=PropList.Get(0)) then\n' m =fthm.HasAttributes\n' m= False\n'end\n\nGrList.Empty\nend\n If (nVie w = true) then\n addToView.SetProjection(theProjection)\n addToView.SetUnits(TheUnits)\n addToView.GetDisplay.ZoomToScale(thescale)\n \n NewDisplay.PanTo(theCenter)\n\n end\naddToView.Invalidate\naddToView.GetWin.Activate\n\n\n\n\n\n\n" ) (Script.60 Name: "conv.OpenDialog" SourceCode: "theView=av.GetActiveDoc\n viewList = {}\n for each d in av.GetProject.GetDocs\n if (d.Is(View)) then\n viewList.Add( d )\n end\n end\n' Include a choice for a new view...\n viewList.Insert(\"\")\n\n'Dict1 = theView.GetThemes\nTheDialog = av.FindDialog(\"conv\")\nAVUpperLeft = av.ReturnOrigin \nAVCenter = avUpperLeft + (av.ReturnExtent / (2@2)) \nhalfDialogWidthHeight = TheDialog.ReturnExtent.ReturnSize / (2@2) \nMovePoint = AVCenter - halfDialogWidthHeight \nTheDialog.MoveTo(MovePoint.Get X, MovePoint.GetY)\n\naAct = TheDialog.FindByName(\"aAct\")\naAct.Select\nLegYes = TheDialog.FindByName(\"LegYes\") \nDefNo = TheDialog.FindByName(\"DefNo\") \nvidYes = TheDialog.FindByName(\"vidYes\") \nRezh1 = TheDialog.FindByName(\"Rezh1\") \nname1 = TheDialog.FindByName(\"name1\") \nVList = TheDialog.FindByName(\"VList\")\nLegYes.Select\nDefNo.Select\nvidYes.Select\nRezh1.Select\nname1.Select\nVList.DefineFromlist(ViewList)\nthedialog.Open\n" ) (Script.61 Name: "conv.Update" SourceCode: "if(av.GetProject=nil) then\n return nil\nend\n\nif(av.GetProject.IsClosing) then\n return nil\n end\naMenu = av.FindGUI( \"View\").GetButtonBar\n aChoice=aMenu.FindByScript (\"conv.OpenDialog\")\n if (aChoice<>nil)then\n aMenu.Remove(aChoice)\n end\n \n" ) (Script.62 Name: "convExt.Unload" SourceCode: "Dialog.DetachFromExtension(self)\nif(av.GetProject=nil) then\n return nil\nend\n\nif(av.GetProject.IsClosing) then\n return nil\n end\naMenu = av.FindGUI( \"View\").GetButtonBar\n aChoice=aMenu.FindByScript (\"conv.OpenDialog\")\n if (aChoice<>nil)then\n aMenu.Remove(aChoice)\n end\naMenu.Update \n'aMenuList = av.FindGUI( \"View\").GetMenuBar.GetControls\n'For each h in 0..(aMenuList.count-1)\n' aName=av.FindGUI( \"View\").GetMenuBar.GetControls.Get(h).GetLabel\n' if (aName=\"MyExt\") then\n' aMenu=av.Fi ndGUI( \"View\").GetMenuBar.GetControls.Get(h)\n' aChoice=aMenu.FindByScript (\"conv.OpenDialog\")\n' if (aChoice<>nil)then\n' aMenu.Remove(aChoice)\n' end\n' \n' end\n'end\n" ) (Script.63 Name: "convExt.Install" SourceCode: "'convExt.Install\n\nif (av.GetProject = nil) then\n return nil\nend\naMenu=av.FindGUI( \"View\").GetButtonBar\naButton = aMenu.FindByScript(\"conv.OpenDialog\")\nif (aButton = nil) then\n\n newButton = Button.Make\n newButton.SetIcon( IconMgr.GetIcons.Get(30))\n newButton.SetClick( \"conv.OpenDialog\" )\n newButton.SetHelp( \"convert Themes//Конвертирование тем\" )\n\n\n ' Add the button to the ButtonBar\n aMenu.Add( newButton, -1 )\n\nend\n\n\n'aMenu=av.FindGUI( \"View\").GetMenuBar.FindByLabel(\"MyExt\")\n'if (aMenu = nil) then\n' amenu=Menu.Make\n' amenu.SetLabel(\"MyExt\")\n' av.FindGUI( \"View\").GetMenuBar.Add(amenu,10) \n'end\n\n' newchoice=aMenu.FindByLabel(\"Конвертирование тем\")\n'if (newchoice = nil) then\n' newchoice=Choice.Make\n' newchoice.SetLabel(\"Конвертирование тем\")\n' newchoice.SetClick(\"conv.OpenDialog\")\n' aMenu.Add(newchoice,0)\n'end\n\n" )