Hi ,
I am new to UDIG I want to display a default map when a RCP application is   
started. I am following RCP tutorial.
I am able to add the layer to the map but not able to view the   map. I am 
using the countries.shp file available with demo data.
I have added following piece of code in createPartControl() method of MapView 
class



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

            Project udigProject = projectRegistry.getProject("D:\\Example 
Resources\\ProjectTemplates\\temp.udig");

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

            IMap map1 = list.get(0);

            List<ILayer> projectLayers = map1.getMapLayers();
            System.out.println("projectLayers" + map1.getName() + "layerCount : 
" + projectLayers.size() + " bounds : " + map1.getBounds(null).getMinX());
            map = (Map) map1 ;
              
map.sendCommandSync(BasicCommandFactory.getInstance().createAddManyLayers(projectLayers));
            ReferencedEnvelope bounds = map.getViewportModel().getBounds();
            System.out.println("Bounds are : " + bounds.getMinX() + 
bounds.getMaxX());
            map.getViewportModelInternal().setBounds(bounds);

            map.getViewportModelInternal().setCRS(DefaultGeographicCRS.WGS84);
            map.sendCommandASync(new SetViewportBBoxCommand(bounds));
            mapviewer.setMap(map);

The printMapAction shows the name of the layer and the information that the 
layer is visible , but the map is not  shown .
I followed similar forums and found out the extent needs to be set for display 
of the map. I am trying to set the bounds and CRS through these statements.

map.getViewportModelInternal().setBounds(bounds);

            map.getViewportModelInternal().setCRS(DefaultGeographicCRS.WGS84);
            map.sendCommandASync(new SetViewportBBoxCommand(bounds));

Am I missing   something   or doing something wrong   ?  I am able to get and 
set the bounds of Viewport but cannot   find any method to set the bounds of 
the   Map object.

Appreciate, if I can get some insight in this scenario.


Thanks & Regards
Nidhi


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have 
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to