'script naam: Soortkarteren.Zetpunt 'jaar van "verre toekomst" aangepast van 2010 naar 2099 ADB = av.FindDialog("soorttotaal") soortIsOpen = false if (ADB.IsOpen = true) then soortIsOpen = true ADB.Close return nil end theView = av.GetActiveDoc if (theView <> _karteerView) then MsgBox.Info("U werkt in de verkeerde view","") return nil end active = theView.GetActiveThemes.Get(0) theTheme = _karteerThema EditableTheme = theView.GetEditableTheme if (theTheme <> EditableTheme) then MsgBox.Info("Het thema waarin u wilt karteren is niet (meer) bewerkbaar. Druk (opnieuw) op de karteerknop.","") return nil end if (active = nil) then MsgBox.info("Er is geen thema actief","U kunt geen punt plaatsen") return nil end if (theTheme <> active) then if (theTheme <> nil) then active.Setactive(false) theTheme.Setactive(true) end end if (theTheme <> nil) then theFTab = theTheme.GetFTab theDialogEditor = av.FindDialog("query") if (theFTab.FindField("CBS_naam") = nil) then doelVeld1 = theFTab.FindField("Naam") else doelVeld1 = theFTab.FindField("CBS_naam") end if (theFTab.FindField("CBS_soort") = nil) then doelVeld2 = theFTab.FindField("nummer") else doelVeld2 = theFTab.FindField("CBS_soort") end if (theFTab.FindField("CBS_latijn") = nil) then doelVeld3 = theFTab.FindField("Wetens") else doelVeld3 = theFTab.FindField("CBS_latijn") end doelVeld4 = theFTab.FindField("ID") doelVeld5 = theFTab.FindField("X_coord") doelVeld6 = theFTab.FindField("Y_coord") if (theFTab.FindField("CBS_groep") = nil) then doelVeld7 = theFTab.FindField("groep") else doelVeld7 = theFTab.FindField("CBS_groep") end doelveld8 = theFtab.FindField("aantal") doelveld9 = theFtab.FindField("jaar") doelveld10 = theFtab.FindField("Waarn") doelveld11 = theFtab.Findfield("opm") doelveld12 = theFtab.FindField("methode") doelveld13 = theFtab.FindField("geb_cod") doelveld14 = theFtab.Findfield("broedc") ontbreeklijst = list.make if (doelveld1 = nil) then ontbreeklijst.add("naam") end if (doelveld2 = nil) then ontbreeklijst.add("soortnummer") end if (doelveld3 = nil) then ontbreeklijst.add("Wetenschappelijk") end if (doelveld5 = nil) then ontbreeklijst.add("X_coord") end if (doelveld6 = nil) then ontbreeklijst.add("Y_coord") end if (doelveld7 = nil) then ontbreeklijst.add("Soortgroep") end if (ontbreeklijst.count >0) then MsgBox.ListAsString(ontbreeklijst,"De volgende verplichte velden ontbreken:","U kunt geen punt plaatsen") return nil end catstring = _catstring if (catstring <> nil) then 'aFileString = "C:\wschijf\app\catalogi\soortinvoer\"+catstring.Left(6)+".dbf" 'cbsCat = VTab.Make(aFileString.AsFileName, False, False) cbsCat = av.GetProject.FindDoc(catString).GetVTab naamField = cbsCat.FindField("Nederlands") codeField = cbsCat.FindField("Soortnr") groepField = cbsCat.FindField("Groepnr") latijnField = cbsCat.FindField("Wetenschap") end if (cbsCat.Getselection.count = 0) then MsgBox.Info("Er is geen soort geselecteerd","") cbsCat.GetSelection.ClearAll cbsCat.UpdateSelection theDialogEditor.Open theDialogEditor.FindByName("txl_Wildcard").Focus return nil end '___________________________________________________________ 'Variabelen zetten aMethodCombo = theDialogEditor.Findbyname("aCbx_methode") recordLijst = cbsCat.Getselection recNo = recordLijst.GetNextSet(-1) aNaam = cbsCat.Returnvalue(naamField, RecNo) aNum = cbsCat.Returnvalue(codeField, recNo) aGroep = cbsCat.Returnvalue(groepField, recNo) aLatijn = cbsCat.Returnvalue(latijnField, recNo) anAantal = theDialogEditor.FindbyName("txl_aantal").GetText if (anAantal.Isnumber = false) then MsgBox.Info("Het aantal moet een getal zijn (minimaal 1)","") av.run("Soortkarteren.DialogReOpen",{}) theDialogEditor.FindByName("txl_Aantal").Focus return nil end aJaar = theDialogEditor.FindbyName("txl_jaar").GetText if (aJaar.Isnumber = false) then MsgBox.Info("Het jaartal moet een getal zijn","") av.run("Soortkarteren.DialogReOpen",{}) theDialogEditor.FindByName("txl_Jaar").Focus return nil end if (aJaar.asNumber < 1900) then MsgBox.Info("Het jaar"++aJaar++"is wel erg lang geleden","") av.run("Soortkarteren.DialogReOpen",{}) theDialogEditor.FindByName("txl_Jaar").Focus return nil end if (aJaar.asNumber > 2099) then MsgBox.Info("Het jaar"++aJaar++"is nog verre toekomst","") av.run("Soortkarteren.DialogReOpen",{}) theDialogEditor.FindByName("txl_Jaar").Focus return nil end aWaarnemer = theDialogEditor.FindbyName("txl_Waarnemer").GetText anOpmerking = theDialogEditor.FindbyName("txl_Opmerking").GetText aGebcode = theDialogEditor.FindbyName("txl_gebiedscode").GetText aBroedcode = theDialogEditor.FindbyName("txl_Broedcode").GetText aMethod = aMethodCombo.GetCurrentValue theTheme.GetFTab.GetSelection.ClearAll theTheme.GetFTab.refresh pt = theView.GetDisplay.ReturnUserPoint thePrj = theView.GetProjection if (thePrj.IsNull.Not) then pt = pt.ReturnUnprojected(thePrj) end theField1 = theTheme.GetFTab.FindField("Shape") theTheme.GetFTab.BeginTransaction rec = theTheme.GetFTab.AddRecord theTheme.GetFTab.SetValue(theField1, rec, pt) theTheme.GetFTab.EndTransaction selectie = theTheme.GetFTab.GetSelection.Set(rec) theTheme.GetFTab.UpdateSelection else MsgBox.Info("Er is momenteel geen kaart in bewerking","U kunt geen punt plaatsen") return nil end '_________________________________________________________________________ 'Invullen van tabel ' Put the FTab in edit mode and if successful, do some edits. if (theFTab.StartEditingWithRecovery) then 'these four editing operations contained in this Begin/End transaction 'block can be undone or reapplied as a group using FTab.Undo or FTab.Redo theFTab.BeginTransaction theFTab.SetValue(doelVeld1,rec,aNaam.AsString) theFTab.SetValue(doelVeld2,rec,aNum) theFtab.SetValue(doelveld3,rec,aLatijn) theFtab.SetValue(doelveld4,rec,0) theFTab.Calculate("[Shape].GetX", doelveld5) theFTab.Calculate("[Shape].GetY", doelveld6) theFtab.SetValue(doelveld7,rec,aGroep) theFTab.Calculate(anAantal, doelveld8) theFTab.Calculate(aJaar, doelveld9) theFtab.SetValue(doelveld10,rec,aWaarnemer) theFtab.SetValue(doelveld11,rec,anOpmerking) if (doelveld12<>nil) then theFtab.SetValue(doelveld12,rec,aMethod) end if (doelveld13<>nil) then theFtab.SetValue(doelveld13,rec,aGebcode) end if (doelveld14<>nil) then theFtab.SetValue(doelveld14,rec,aBroedcode) end theFTab.EndTransaction end av.GetProject.SetModified(true) '__________________________________________________________________________ fthm = thetheme theleg=fthm.getlegend thelegType = theleg.getlegendtype if ((thelegtype = #LEGEND_TYPE_UNIQUE) and (aNaam <> "")) then naam = "naam" theleg.SetLegendType(#LEGEND_TYPE_UNIQUE) theleg.Unique(fthm,naam.asstring) theColorSchemes = SymbolList.GetPreDefined(#SYMLIST_TYPE_COLORSCHEME) for each scheme in theColorSchemes if (scheme.GetName = "Fruits & Vegetables") then theColorScheme = scheme end end theleg.GetSymbols.RandomSavedSymbols(theColorScheme) theFill=symbol.Make(#SYMBOL_FILL) TheColor=Color.Make TheColor.SetTransparent (TRUE) 'TheFill.SetOLColor(Color.GetBlack) TheFill.SetColor(theColor) theleg.DisplayNoDataClass (TRUE) theTheme.updatelegend theView.getdisplay.InValidate(true) end