Maptitude - http://research.umbc.edu/~roswell/maptitude.html --------------------------- ListBot Sponsor -------------------------- Get fast, easy info by phone: Call 800-555-TELL.\nNews, weather, restaurants...& much more!\n\n http://on.linkexchange.com/?ATID=27&AID=2143 ---------------------------------------------------------------------- This is good, and big thanks go to Armando. Can anyone modify this to include data transfer? To include point and polygon data? Can Caliper add this functionality to Maptitude? ---------- Forwarded message ---------- Date: Thu, 08 Feb 2001 12:30:00 +0000 From: GeoMatic <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Copying lines from one layer to another Dear Marjorie. Here is the macro to transfer lines from one layer to another. I am including the code and a ZIP file with the Add-In. Would you please pass the message to the list and upload it? (I am reluctant to send attachments to a mailing list) The name of the Add In is CopyLines (to be filled in the "Name" field of the AddIn Setup Dialog Box) Limitations: - The target layer must be in the standard format. - Both layers should be in the same map. - only the geometry is copied, no attached data is passed to the new layer. (this can be improved with little extra programming, let me know if you need it and I will try to find some free time to add it) Before running the Add-In you have to select the lines you want to transfer in the source layer. After the seleection is made, run the add in. A dialog box will ask you for the source and target layer as well as the selection set. Please let me know of any problems or bugs you encounter. Good Luck Armando Scalise ---------------------------------------------- MAcro "CopyLines" // checks to see if a map is active m=GetMap() if m=null then do ShowMessage("An active map is needed") Return() end // get Parameters r=RunDbox ("parameters",&source,&target,&selection,&snapnode,&snaplink) If source=null or target=null or selection =null then do ShowMessage("A parameter is missing") Return() end if r<>1 then Return() // checks that target and source are not the same layer if source=target then do ShowMessage("Source and target layers must be different!") Return() end // get current layer l1=GetLayer() SetLayer(source) view=GetView() // Get all lines in selection set lines=null rh=GetFirstRecord(source+"|"+selection,) while rh<>null do id=rh2id(rh) // Get the coordinates this line in the selection lines=lines+{GetLine(id)} rh=GetNextRecord(source+"|"+selection,,) end // Now, copy all the lines in the array to the target layer SetLayer(target) r2=null for i=1 to lines.length do r=AddLink (lines[i],,{{"Snap Node",snapnode},{"Snap Link",snapnode}} ) //put the new ID in an array r2=r2+r[1] end // set in the original layer setlayer(l1) endMacro Dbox "parameters" (source,target,selection,snapnode,snaplink) 10,30 Init do s=GetMapLayers(, "Line") so=s[1] t=null // selec for i=1 to s[1].length do if isLayer(s[1][i],{"DBD Line"}) =1 then t=t+{s[1][i]} end endItem Popdown Menu "Source" 5,1,30,5 Prompt: "Source Layer:" List: so variable: index1 do source=so[index1] SetLayer(so[index1]) s2=Getsets() endItem Popdown Menu "Target" 5,3,30,5 Prompt: "Target Layer:" List: t variable: index2 do target=t[index2] endItem PopDown Menu "Selection" 5,5,30,5 Prompt: "Set to transfer:" List: s2 variable: index3 do selection=s2[index3] endItem Button "OK" 12, 7, 10 do Return(1) endItem Button "Cancel" 20, 7, 10 do Return(2) endItem enddbox ______________________________________________________________________ To unsubscribe, write to [EMAIL PROTECTED]
