org.gwtopenmaps.openlayers.client.Projection Java Examples

The following examples show how to use org.gwtopenmaps.openlayers.client.Projection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SaveProjectTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private VectorFeature[] getTransformedFeatures(Vector vectorLayer, String epsg) {
		List<VectorFeature> transformedFeatures = new ArrayList<VectorFeature>();
		if (vectorLayer.getFeatures() != null) {
//			logger.info("N. features de la Capa: " + layer.getFeatures().length);
			for (VectorFeature feature : vectorLayer.getFeatures()) {
				VectorFeature featureToExport = feature.clone();
				featureToExport.getGeometry().transform(
						new Projection(GeoMap.INTERNAL_EPSG),
						new Projection(epsg));
				transformedFeatures.add(featureToExport);
			}
		}
		VectorFeature[] transArray = new VectorFeature[transformedFeatures
				.size()];
		return transformedFeatures.toArray(transArray);
}
 
Example #2
Source File: CustomExtentTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@PostConstruct
private void initialize() {

	customExtentDialog.getAddToMapButton().addSelectHandler(
			new SelectHandler() {

				@Override
				public void onSelect(SelectEvent event) {
					if (!isBBoxEmpty() && has4Coordinates()) {
						Bounds bounds = getBounds();

						Geometry geom = bounds.toGeometry();
						geom.transform(new Projection("EPSG:4326"),
								new Projection(geoMap.getMap()
										.getProjection()));
						VectorFeature vf = new VectorFeature(geom);

						VectorLayer bboxLayer = VectorLayerFactory
								.createEmptyVectorLayer(createBBoxLayerConfig());
						bboxLayer.addFeature(vf);

						layerManager.addVector(bboxLayer);
					}
				}
			});
}
 
Example #3
Source File: SaveLayerTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private VectorFeature[] getTransformedFeatures() {
	List<VectorFeature> transformedFeatures = new ArrayList<VectorFeature>();
	if (layer.getFeatures() != null) {
		logger.info("N. features de la Capa: " + layer.getFeatures().length);
		for (VectorFeature feature : layer.getFeatures()) {
			VectorFeature featureToExport = feature.clone();
			featureToExport.getGeometry().transform(
					new Projection(GeoMap.INTERNAL_EPSG),
					new Projection("WGS84"));
			transformedFeatures.add(featureToExport);
		}
	}
	VectorFeature[] transArray = new VectorFeature[transformedFeatures
			.size()];
	return transformedFeatures.toArray(transArray);
}
 
Example #4
Source File: MapPreviewWidget.java    From geofence with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates the map option.
 *
 * @param isGoogle
 *            the is google
 */
private void createMapOption(boolean isGoogle)
{
    // TODO Auto-generated method stub

    OpenLayers.setProxyHost("gwtOpenLayersProxy?targetURL=");

    this.defaultMapOptions = new MapOptions();
    this.defaultMapOptions.setNumZoomLevels(18);
    if (isGoogle)
    {
        this.defaultMapOptions.setProjection("EPSG:900913");
        this.defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326"));
        this.defaultMapOptions.setUnits(MapUnits.METERS);
        this.defaultMapOptions.setMaxExtent(new Bounds(-20037508, -20037508, 20037508,
                20037508.34));
        this.defaultMapOptions.setMaxResolution(new Double(156543.0339).floatValue());
    }
    else
    {
        this.defaultMapOptions.setProjection("EPSG:4326");
    }

    initMapWidget(this.defaultMapOptions, isGoogle);
}
 
Example #5
Source File: GeoMap.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public void configure(final Projection displayProjection, final Integer numZoomLevels, final String units) {
	this.displayProjection = displayProjection; 		

	mapOptions = new MapOptions();
mapOptions.setDisplayProjection(this.displayProjection);
mapOptions.setNumZoomLevels(numZoomLevels);
mapOptions.setUnits(units);
mapOptions.setMaxExtent(getDefaultMapBound());
mapOptions.setMaxResolution(appClientProperties.getFloatValue("maxResolution"));
getMap().setOptions(mapOptions);
getMap().setMinMaxZoomLevel(0, 50);
}
 
Example #6
Source File: WfsVectorLayerDef.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public void generateBbox() {
	queryBbox = true;
	GeoMap geoMap = IOC.getBeanManager().lookupBean(GeoMap.class)
			.getInstance();
	if (GeoMap.INTERNAL_EPSG.equals(getEpsg())) {
		this.bbox = geoMap.getMap().getExtent();
	} else {
		this.bbox = geoMap.getMap().getExtent()
				.transform(new Projection(GeoMap.INTERNAL_EPSG),
						new Projection(getEpsg()));
	}
}
 
Example #7
Source File: MeasureElementTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private double calculatePolygonLenght(Polygon polygon) {
	double lenght = 0;
	for (LinearRing ring : polygon.getComponents()) {
		lenght = lenght
				+ ring.getGeodesicLength(new Projection(
						GeoMap.INTERNAL_EPSG));
	}
	return lenght;
}
 
Example #8
Source File: CurrentExtentTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private String getWKTToWGS84(Bounds bounds) {
	Geometry geom = bounds.toGeometry().clone();
	geom.transform(new Projection(geoMap.getMap().getProjection()), new Projection("EPSG:4326"));
	VectorFeature extentFeature = new VectorFeature(geom);
	WKT wktFormat = new WKT();
	return wktFormat.write(extentFeature);
}
 
Example #9
Source File: ExportDataTool.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
public VectorFeature[] getTransformedFeatures(Vector layer, String epsg) {
	List<VectorFeature> transformedFeatures = new ArrayList<VectorFeature>();
	if (layer.getFeatures() != null) {
		for (VectorFeature feature : layer.getFeatures()) {
			VectorFeature featureToExport = feature.clone();
			featureToExport.getGeometry().transform(
					new Projection(geoMap.getMap().getProjection()),
					new Projection(epsg));
			transformedFeatures.add(featureToExport);
		}
	}
	VectorFeature[] transArray = new VectorFeature[transformedFeatures
			.size()];
	return transformedFeatures.toArray(transArray);
}
 
Example #10
Source File: MapPreviewWidget.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draw aoi on map.
 *
 * @param wkt
 *            the wkt
 */
public void drawAoiOnMap(String wkt)
{
    this.eraseFeatures();

    MultiPolygon geom = MultiPolygon.narrowToMultiPolygon(Geometry.fromWKT(wkt).getJSObject());
    geom.transform(new Projection("EPSG:4326"), new Projection("EPSG:900913"));

    VectorFeature vectorFeature = new VectorFeature(geom);
    this.vector.addFeature(vectorFeature);
    this.map.zoomToExtent(geom.getBounds());
}
 
Example #11
Source File: GeoMap.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
public Projection getDisplayProjection() {
	return displayProjection;
}
 
Example #12
Source File: GeoMap.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
public void configure(final String displayProjection, final Integer numZoomLevels, final String units) {		
	this.configure(new Projection(displayProjection), numZoomLevels, units);
}
 
Example #13
Source File: VectorLayerConfig.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
public Projection getProjection() {		
	return new Projection(getEpsg());
}
 
Example #14
Source File: VectorLayerConfig.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
public Projection getDefaultProjection() {
	return DEFAUL_PROJECTION;
}
 
Example #15
Source File: CSV.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
private VectorFeature getTransformedFeatures(VectorFeature vectorFeature) {
	VectorFeature featureToExport = vectorFeature.clone();
	featureToExport.getGeometry().transform(new Projection(GeoMap.INTERNAL_EPSG), new Projection(this.projection));

	return featureToExport;
}
 
Example #16
Source File: OpenLayersMapWrapper.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private void initializeDefaultMapOptions() {
    defaultMapOptions.setMaxResolutionToAuto();
    defaultMapOptions.setNumZoomLevels(18);
    defaultMapOptions.setUnits(MapUnits.DEGREES);
    defaultMapOptions.setDisplayProjection(new Projection(DISPLAY_PROJECTION));
}