Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [udig-devel] Path update in Udig project file

I will try to explain myself in more detail.

 

I have an RCP done with udig libraries. I have a Map view and a Layer view.

 

I have created an udig project from udig with some shapefiles in order to get it loaded from my program when it starts.

 

When I created it, udig took local paths for shapefiles layers in that project.

 

So when I run my application it loads shapefiles correctly. But when a partner runs it in his own machine they get an I/O exception since the path for the shapefiles within the udig project file I created are different and not found in their machines.

 

I was trying to modify (with the runtime local machine paths) the udig project file on runtime when my application starts but I have seen those encoded xml attributes and I don’t know how to deal with them.

 

So has I have seen there is a way to load the project and change shapefiles path of the project layers right?

 

I have done:

 

ProjectRegistry projectRegistry = ProjectPlugin.getPlugin().getProjectRegistry();

Project udigProject = projectRegistry.getProject(defaultUrl.getPath());

List<IMap> lista = udigProject.getElements(IMap.class);

map = lista.get(0);

 

Resource resource = ((EObject) map).eResource();

org.eclipse.emf.common.util.URI uri =  org.eclipse.emf.common.util.URI.createURI(projectFileUrl.getFile());

Resource newResource = resource.getResourceSet().createResource(uri);

newResource.getContents().add((EObject) map);

resource.setModified(true);

try {

      resource.save(ProjectPlugin.getPlugin().saveOptions);

} catch (IOException e) {

      // TODO Auto-generated catch block

      e.printStackTrace();

}

 

Nothing happens… I think I should save on the project those resources or something similar?

Thank you in advance

Cheers!

 


From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jesse Eichar
Sent: jueves, 06 de noviembre de 2008 17:11
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Path update in Udig project file

 

You can update the project path as well.  

 

Jesse

 

On 6-Nov-08, at 4:42 PM, Mario Nuñez Jimenez wrote:



Hello again.

I was thinking about

 

udigProject.eResource().getURI()

 

cant I update the udig project path also?

 

I didn’t manage to change map path and save them


From: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jesse Eichar
Sent: jueves, 06 de noviembre de 2008 16:02
To: User-friendly Desktop Internet GIS
Subject: Re: [udig-devel] Path update in Udig project file

 

Hi,  You don't want to touch that in any way.  When a map is saved the IGeoResources that the layer uses is saved with all the data required to load the IGeoResource again.  The reasoning is so that you can give a map to another uDig user and have the map be able to be loaded.  The map is saved any time the mapeditor is closed and on shutdown of uDig.  You can trigger a saving by:

 

            Resource resource = ((Map)map).eResource();

        resource.setModified(true);

        resource.save(ProjectPlugin.getPlugin().saveOptions);

        

If you want to change the path of a map or a project do it through Project.eResource and Map.eResource.  But be careful because the ProjectRegistry needs to be able to keep track of the new resource.  So for example if you want to change the resource (save location) of a map you want to do something like:

           

            Resource resource = ((Map)map).eResource();

        Resource newResource = resource.getResourceSet().createResource(URI.createFileURI("/path/projectfile.udig"));

        newResource.getContents().add((EObject) map);

        

I think that will work.  I don't think you need to remove from the old resource because I think that happens automatically.

 

Hope that helps,

 

Jesse

 

On 6-Nov-08, at 3:06 PM, Mario Nuñez Jimenez wrote:




Hello,

Could please someone give any tip about getting decoded XML attribute catalogRef from layers XML element in project udig file (*.umap)

I need to change this path in runtime, so I need to get it, decode it, change it, encode the new one and set again in the XML file.

It looks like this:

 

<layers name="thai_south_counties" catalogRef="%23Tue+Oct+21+17%3A28%3A59+CEST+2008%0D%0Afile_export_version%3D3.0%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fshapefile%5C+url%2Ftype%3Djava.net.URL%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fshapefile%5C+url%2Fvalue%3Dfile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fdbf%5C+charset%2Fvalue%3Dwindows-1252%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fcreate%5C+spatial%5C+index%2Ftype%3Djava.lang.Boolean%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fcreate%5C+spatial%5C+index%2Fvalue%3Dtrue%0D%0A%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2Fdbf%5C+charset%2Ftype%3Djava.lang.String%0D%0A%5C%21%2Fnet.refractions.udig.project%2Ffile%253A%252FD%253A%252Fshapefiles%252FThailand%252FThailand%2BSouth%2BCounties%2B%2528FIPS%2529%252Fthai_south_counties.shp%2523thai_south_counties%3D%0D%0A" iD="file:/D:/workspace/org.dews_online.ccui.core/shapefiles/Thailand/Thailand_South_Counties_FIPS/thai_south_counties.shp#thai_south_counties" defaultColor="#666666">

 

I have tried with URLDecoder but does not work…

Thank you in advance!

 

------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive 
this e-mail in error, please notify the sender immediately and destroy it. 
As its integrity cannot be secured on the Internet, the Atos Origin 
group liability cannot be triggered for the message content. Although 
the sender endeavours to maintain a computer virus-free network, 
the sender does not warrant that this transmission is virus-free and 
will not be liable for any damages resulting from any virus transmitted. 

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial 
destinada solamente a la(s) persona(s) mencionadas anteriormente 
pueden estar protegidos por secreto profesional. 
Si usted recibe este correo electronico por error, gracias por informar 
inmediatamente al remitente y destruir el mensaje. 
Al no estar asegurada la integridad de este mensaje sobre la red, Atos Origin 
no se hace responsable por su contenido. Su contenido no constituye ningun 
compromiso para el grupo Atos Origin, salvo ratificacion escrita por ambas partes. 
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor 
no puede garantizar nada al respecto y no sera responsable de cualesquiera 
danos que puedan resultar de una transmision de virus. 
------------------------------------------------------------------ _______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

 

 

------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive 
this e-mail in error, please notify the sender immediately and destroy it. 
As its integrity cannot be secured on the Internet, the Atos Origin 
group liability cannot be triggered for the message content. Although 
the sender endeavours to maintain a computer virus-free network, 
the sender does not warrant that this transmission is virus-free and 
will not be liable for any damages resulting from any virus transmitted. 

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial 
destinada solamente a la(s) persona(s) mencionadas anteriormente 
pueden estar protegidos por secreto profesional. 
Si usted recibe este correo electronico por error, gracias por informar 
inmediatamente al remitente y destruir el mensaje. 
Al no estar asegurada la integridad de este mensaje sobre la red, Atos Origin 
no se hace responsable por su contenido. Su contenido no constituye ningun 
compromiso para el grupo Atos Origin, salvo ratificacion escrita por ambas partes. 
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor 
no puede garantizar nada al respecto y no sera responsable de cualesquiera 
danos que puedan resultar de una transmision de virus. 
------------------------------------------------------------------ _______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

 

 
------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive
this e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos Origin
group liability cannot be triggered for the message content. Although
the sender endeavours to maintain a computer virus-free network,
the sender does not warrant that this transmission is virus-free and
will not be liable for any damages resulting from any virus transmitted.

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial
destinada solamente a la(s) persona(s) mencionadas anteriormente
pueden estar protegidos por secreto profesional.
Si usted recibe este correo electronico por error, gracias por informar
inmediatamente al remitente y destruir el mensaje.
Al no estar asegurada la integridad de este mensaje sobre la red, Atos Origin
no se hace responsable por su contenido. Su contenido no constituye ningun
compromiso para el grupo Atos Origin, salvo ratificacion escrita por ambas partes.
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor
no puede garantizar nada al respecto y no sera responsable de cualesquiera
danos que puedan resultar de una transmision de virus.
------------------------------------------------------------------

Back to the top