@@ -54,10 +54,11 @@ class GeoNodeViewer extends React.Component {
5454 constructor ( props ) {
5555 super ( props ) ;
5656 this . state = {
57+ tileServices : undefined ,
5758 errors : [ ] ,
5859 errorOpen : false
5960 } ;
60- this . _local = getLocalGeoServer ( props . sources , props . baseUrl ) ;
61+ this . _local = getLocalGeoServer ( props . config . sources , props . baseUrl ) ;
6162 }
6263 getChildContext ( ) {
6364 return {
@@ -70,24 +71,19 @@ class GeoNodeViewer extends React.Component {
7071 this . updateMap ( this . props ) ;
7172 this . mode = this . props . mode || 'viewer' ;
7273 this . edit = ( this . mode === 'composer' ) ;
73- if ( this . props . layer ) {
74- WMSService . createLayerFromGetCaps ( this . props . wmsServer , this . props . layer , map . getView ( ) . getProjection ( ) , function ( layer ) {
75- map . addLayer ( layer ) ;
76- map . getView ( ) . fit ( ol . proj . transformExtent ( layer . get ( 'EX_GeographicBoundingBox' ) , 'EPSG:4326' , map . getView ( ) . getProjection ( ) ) , map . getSize ( ) , { constrainResolution : false } ) ;
77- } , this . props . proxy ) ;
78- }
7974 }
8075 componentWillReceiveProps ( props ) {
8176 this . updateMap ( props ) ;
8277 }
8378 updateMap ( props ) {
8479 if ( props . config ) {
80+ var tileServices = [ ] ;
8581 var errors = [ ] ;
8682 var filteredErrors = [ ] ;
8783 if ( props . zoomToLayer && props . config . map . layers [ props . config . map . layers . length - 1 ] . bbox ) {
8884 this . _extent = props . config . map . layers [ props . config . map . layers . length - 1 ] . bbox ;
8985 }
90- MapConfigService . load ( MapConfigTransformService . transform ( props . config , errors ) , map , this . props . proxy ) ;
86+ MapConfigService . load ( MapConfigTransformService . transform ( props . config , errors , tileServices ) , map , this . props . proxy ) ;
9187 for ( var i = 0 , ii = errors . length ; i < ii ; ++ i ) {
9288 // ignore the empty baselayer since we have checkbox now for base layer group
9389 if ( errors [ i ] . layer . type !== 'OpenLayers.Layer' ) {
@@ -99,7 +95,8 @@ class GeoNodeViewer extends React.Component {
9995 }
10096 this . setState ( {
10197 errors : filteredErrors ,
102- errorOpen : true
98+ errorOpen : true ,
99+ tileServices : tileServices
103100 } ) ;
104101 }
105102 }
@@ -152,7 +149,7 @@ class GeoNodeViewer extends React.Component {
152149 < div id = 'globe-button' > < Globe tooltipPosition = 'right' map = { map } /> </ div >
153150 < div id = 'print-button' > < QGISPrint menu = { false } map = { map } layouts = { this . props . printLayouts } /> </ div >
154151 < div id = 'home-button' > < HomeButton extent = { this . _extent } tooltipPosition = 'right' map = { map } /> </ div >
155- < div > < LayerList showZoomTo = { true } addBaseMap = { { tileServices : undefined } } addLayer = { layerList } showTable = { true } allowReordering = { true } includeLegend = { true } allowRemove = { this . edit } tooltipPosition = 'left' allowStyling = { this . edit || this . props . zoomToLayer } map = { map } /> </ div >
152+ < div > < LayerList showZoomTo = { true } addBaseMap = { { tileServices : this . state . tileServices } } addLayer = { layerList } showTable = { true } allowReordering = { true } includeLegend = { true } allowRemove = { this . edit } tooltipPosition = 'left' allowStyling = { this . edit || this . props . zoomToLayer } map = { map } /> </ div >
156153 < div id = 'zoom-buttons' > < Zoom tooltipPosition = 'right' map = { map } /> </ div >
157154 < div id = 'rotate-button' > < Rotate autoHide = { true } tooltipPosition = 'right' map = { map } /> </ div >
158155 < div id = 'popup' className = 'ol-popup' > < InfoPopup toggleGroup = 'navigation' toolId = 'nav' infoFormat = 'application/vnd.ogc.gml' map = { map } /> </ div >
@@ -165,13 +162,12 @@ class GeoNodeViewer extends React.Component {
165162
166163GeoNodeViewer . props = {
167164 config : React . PropTypes . object ,
165+ loadMapConfig : React . PropTypes . bool ,
168166 proxy : React . PropTypes . string ,
169167 theme : React . PropTypes . object ,
170168 mode : React . PropTypes . string ,
171169 server : React . PropTypes . string ,
172- printLayouts : React . PropTypes . array ,
173- wmsServer : React . PropTypes . string ,
174- layer : React . PropTypes . string
170+ printLayouts : React . PropTypes . array
175171} ;
176172
177173GeoNodeViewer . defaultProps = {
0 commit comments