test_class.declarator: DOUBLE_TOLERANCE = .0000000001
test_class.modifier: private static final
test_class.original_string: private static final double DOUBLE_TOLERANCE = .0000000001;
test_class.type: double
test_class.var_name: DOUBLE_TOLERANCE
test_class.declarator: LAYER_ID = "countries"
test_class.modifier: private static final
test_class.original_string: private static final String LAYER_ID = "countries";
test_class.type: String
test_class.var_name: LAYER_ID
test_class.declarator: CRS = "EPSG:4326"
test_class.modifier: private static final
test_class.original_string: private static final String CRS = "EPSG:4326";
test_class.type: String
test_class.var_name: CRS
test_class.declarator: dispatcher
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private CommandDispatcher dispatcher;
test_class.type: CommandDispatcher
test_class.var_name: dispatcher
test_class.file: command/src/test/java/org/geomajas/command/configuration/UserMaximumExtentCommandTest.java
test_class.identifier: UserMaximumExtentCommandTest
test_case.body: @Test
  	public void testUserMaximumExtent() throws Exception {
  		UserMaximumExtentRequest request = new UserMaximumExtentRequest();
  		request.setCrs(CRS);
  		request.setLayerIds(new String[] { LAYER_ID });
  		UserMaximumExtentResponse response = (UserMaximumExtentResponse) dispatcher.execute(
  				UserMaximumExtentRequest.COMMAND, request, null, "en");
  		if (response.isError()) {
  			response.getErrors().get(0).printStackTrace();
  		}
  		Assert.assertFalse(response.isError());
  		Bbox bounds = response.getBounds();
  		Assert.assertNotNull(bounds);
  		Assert.assertEquals(-1.0, bounds.getX(), DOUBLE_TOLERANCE);
  		Assert.assertEquals(-1.0, bounds.getY(), DOUBLE_TOLERANCE);
  		Assert.assertEquals(1.0, bounds.getMaxX(), DOUBLE_TOLERANCE);
  		Assert.assertEquals(1.0, bounds.getMaxY(), DOUBLE_TOLERANCE);
  	}
test_case.class_method_signature: UserMaximumExtentCommandTest.testUserMaximumExtent()
test_case.full_signature: @Test public void testUserMaximumExtent()
test_case.identifier: testUserMaximumExtent
test_case.invocations: setCrs setLayerIds execute isError printStackTrace get getErrors assertFalse isError getBounds assertNotNull assertEquals getX assertEquals getY assertEquals getMaxX assertEquals getMaxY
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUserMaximumExtent()
focal_class.declarator: log = LoggerFactory.getLogger(UserMaximumExtentCommand.class)
focal_class.modifier: private final
focal_class.original_string: private final Logger log = LoggerFactory.getLogger(UserMaximumExtentCommand.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: converterService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private DtoConverterService converterService;
focal_class.type: DtoConverterService
focal_class.var_name: converterService
focal_class.declarator: geoService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private GeoService geoService;
focal_class.type: GeoService
focal_class.var_name: geoService
focal_class.declarator: configurationService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private ConfigurationService configurationService;
focal_class.type: ConfigurationService
focal_class.var_name: configurationService
focal_class.declarator: layerService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private VectorLayerService layerService;
focal_class.type: VectorLayerService
focal_class.var_name: layerService
focal_class.declarator: securityContext
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private SecurityContext securityContext;
focal_class.type: SecurityContext
focal_class.var_name: securityContext
focal_class.file: command/src/main/java/org/geomajas/command/configuration/UserMaximumExtentCommand.java
focal_class.identifier: UserMaximumExtentCommand
focal_class.interfaces: implements CommandHasRequest<UserMaximumExtentRequest, UserMaximumExtentResponse>
focal_class.class_method_signature: UserMaximumExtentCommand.getEmptyCommandRequest()
focal_class.full_signature: @Override public UserMaximumExtentRequest getEmptyCommandRequest()
focal_class.identifier: getEmptyCommandRequest
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: UserMaximumExtentRequest
focal_class.signature: UserMaximumExtentRequest getEmptyCommandRequest()
focal_class.class_method_signature: UserMaximumExtentCommand.getEmptyCommandResponse()
focal_class.full_signature: @Override public UserMaximumExtentResponse getEmptyCommandResponse()
focal_class.identifier: getEmptyCommandResponse
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: UserMaximumExtentResponse
focal_class.signature: UserMaximumExtentResponse getEmptyCommandResponse()
focal_class.class_method_signature: UserMaximumExtentCommand.execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_class.full_signature: @Override public void execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_class.return: void
focal_class.signature: void execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_method.body: @Override
  	public void execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response) throws Exception {
  		String[] layers;
  		ArrayList<String> tempLayers = new ArrayList<String>();
  		String[] includeLayers = request.getLayerIds();
  		boolean excludeRasterLayers = request.isExcludeRasterLayers();
  		if (includeLayers != null && includeLayers.length > 0) {
  			for (String layerId : includeLayers) {
  				if (!securityContext.isLayerVisible(layerId)) {
  					throw new GeomajasSecurityException(ExceptionCode.LAYER_NOT_VISIBLE, layerId);
  				}
  				Layer<?> l = configurationService.getLayer(layerId);
  				if (null == l) {
  					throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, layerId);
  				}
  				if (!excludeRasterLayers || l.getLayerInfo().getLayerType() != LayerType.RASTER) {
  					tempLayers.add(l.getId());
  				}
  			}
  		}
  		layers = tempLayers.toArray(new String[tempLayers.size()]);
  
  		Layer<?> layer;
  		Crs targetCrs = geoService.getCrs2(request.getCrs());
  
  		if (layers.length == 0) {
  			// return empty bbox
  			response.setBounds(new Bbox());
  		} else {
  			Envelope extent = new Envelope();
  			for (String layerId : layers) {
  				layer = configurationService.getLayer(layerId);
  				if (layer != null) {
  					Envelope bounds;
  					if (layer.getLayerInfo().getLayerType() == LayerType.RASTER) {
  						bounds = securityContext.getVisibleArea(layerId).getEnvelopeInternal();
  						CrsTransform transform = geoService.getCrsTransform(layer.getCrs(), targetCrs);
  						bounds = geoService.transform(bounds, transform);
  					} else {
  						bounds = layerService.getBounds(layerId, targetCrs, null);
  					}
  					extent.expandToInclude(bounds);
  				} else {
  					log.warn("layer not found ?! " + layerId);
  				}
  			}
  			response.setBounds(converterService.toDto(extent));
  		}
  	}
focal_method.class_method_signature: UserMaximumExtentCommand.execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_method.full_signature: @Override public void execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_method.identifier: execute
focal_method.invocations: getLayerIds isExcludeRasterLayers isLayerVisible getLayer getLayerType getLayerInfo add getId toArray size getCrs2 getCrs setBounds getLayer getLayerType getLayerInfo getEnvelopeInternal getVisibleArea getCrsTransform getCrs transform getBounds expandToInclude warn setBounds toDto
focal_method.modifiers: @Override public
focal_method.parameters: (UserMaximumExtentRequest request, UserMaximumExtentResponse response)
focal_method.return: void
focal_method.signature: void execute(UserMaximumExtentRequest request, UserMaximumExtentResponse response)