/** * @param queryable * the queryable to set */ public void setQueryable( boolean queryable ) { if ( mapOptions != null ) { if ( queryable ) { if ( mapOptions.getFeatureInfoRadius() < 1 ) { mapOptions.setFeatureInfoRadius( 1 ); } } else { if ( mapOptions.getFeatureInfoRadius() > 0 ) { mapOptions.setFeatureInfoRadius( 0 ); } } } else if ( queryable ) { mapOptions = new MapOptions( null, null, null, -1, 1 ); } else { mapOptions = new MapOptions( null, null, null, -1, 0 ); } }
/** * @return the global max features setting */ public int getGlobalMaxFeatures() { return defaultLayerOptions.getMaxFeatures(); }
public Antialias getAntialias( String layer ) { MapOptions opts = options.get( layer ); return opts == null ? null : opts.getAntialias(); }
public void setFeatureInfoRadius( String layer, int radius ) { if ( options.get( layer ) == null ) { options.put( layer, new MapOptions( null, null, null, -1, radius ) ); } else { options.get( layer ).setFeatureInfoRadius( radius ); } }
public void setQuality( String layer, Quality q ) { if ( options.get( layer ) == null ) { options.put( layer, new MapOptions( q, null, null, -1, -1 ) ); } else { options.get( layer ).setQuality( q ); } }
/** * @return true if the layer can be queried * @see MapOptions#getFeatureInfoRadius() */ public boolean isQueryable() { if ( mapOptions == null ) { return true; } // TRICKY assume that, the service is query able by default (<0) return mapOptions.getFeatureInfoRadius() != 0; }
private void adjustMapOptions( LayerMetadata themeMetadata, int queryable, boolean opaque, int cascaded ) { if ( themeMetadata.getMapOptions() == null ) { themeMetadata.setMapOptions( new MapOptions( null, null, null, -1, -1 ) ); } if ( queryable == QUERYABLE_DISABLED_MASK ) { themeMetadata.getMapOptions().setFeatureInfoRadius( 0 ); } else { themeMetadata.getMapOptions().setFeatureInfoRadius( -1 ); } themeMetadata.getMapOptions().setOpaque( opaque ); themeMetadata.setCascaded( cascaded ); }
defaults = new MapOptionsMaps(); handleEnumVSP( Quality.class, getQualitySetter( extensions ), NORMAL, map.get( "QUALITY" ), getQualityGetter( defaults ) ); handleEnumVSP( Interpolation.class, getInterpolationSetter( extensions ), NEARESTNEIGHBOR, map.get( "INTERPOLATION" ), getInterpolationGetter( defaults ) ); handleEnumVSP( Antialias.class, getAntialiasSetter( extensions ), BOTH, map.get( "ANTIALIAS" ), getAntialiasGetter( defaults ) ); String maxFeatures = map.get( "MAX_FEATURES" ); if ( maxFeatures == null ) {
public MapOptionsMaps( Map<String, Quality> qualities, Map<String, Interpolation> interpolations, Map<String, Antialias> antialiases, Map<String, Integer> maxFeatures ) { options = new HashMap<String, MapOptions>(); for ( Entry<String, Quality> e : qualities.entrySet() ) { options.put( e.getKey(), new MapOptions( e.getValue(), null, null, -1, -1 ) ); } for ( Entry<String, Interpolation> e : interpolations.entrySet() ) { if ( options.get( e.getKey() ) != null ) { options.get( e.getKey() ).setInterpolation( e.getValue() ); } else { options.put( e.getKey(), new MapOptions( null, e.getValue(), null, -1, -1 ) ); } } for ( Entry<String, Antialias> e : antialiases.entrySet() ) { if ( options.get( e.getKey() ) != null ) { options.get( e.getKey() ).setAntialias( e.getValue() ); } else { options.put( e.getKey(), new MapOptions( null, null, e.getValue(), -1, -1 ) ); } } for ( Entry<String, Integer> e : maxFeatures.entrySet() ) { setMaxFeatures( e.getKey(), e.getValue() ); } }
public void setInterpolation( String layer, Interpolation interpol ) { if ( options.get( layer ) == null ) { options.put( layer, new MapOptions( null, interpol, null, -1, -1 ) ); } else { options.get( layer ).setInterpolation( interpol ); } }
public void setMaxFeatures( String layer, int maxFeatures ) { if ( options.get( layer ) == null ) { options.put( layer, new MapOptions( null, null, null, maxFeatures, -1 ) ); } else { options.get( layer ).setMaxFeatures( maxFeatures ); } }
public void setAntialias( String layer, Antialias alias ) { if ( options.get( layer ) == null ) { options.put( layer, new MapOptions( null, null, alias, -1, -1 ) ); } else { options.get( layer ).setAntialias( alias ); } }
public MapOptions get( String layer ) { return new MapOptions( getQuality( layer ), getInterpolation( layer ), getAntialias( layer ), getMaxFeatures( layer ), getFeatureInfoRadius( layer ) ); }
/** * @return the default feature info radius */ public int getGlobalFeatureInfoRadius() { return defaultLayerOptions.getFeatureInfoRadius(); }
MapOptions buildMapOptions() { int maxFeatures = 10000; int featureInfoRadius = 1; if ( conf != null ) { LayerOptionsType sf = conf.getDefaultLayerOptions(); alias = handleDefaultValue( sf == null ? null : sf.getAntiAliasing(), Antialias.class, BOTH ); quali = handleDefaultValue( sf == null ? null : sf.getRenderingQuality(), Quality.class, NORMAL ); interpol = handleDefaultValue( sf == null ? null : sf.getInterpolation(), Interpolation.class, NEARESTNEIGHBOR ); if ( sf != null && sf.getMaxFeatures() != null ) { maxFeatures = sf.getMaxFeatures(); LOG.debug( "Using global max features setting of {}.", maxFeatures ); } else { LOG.debug( "Using default global max features setting of {}, set it to -1 if you don't want a limit.", maxFeatures ); } if ( sf != null && sf.getFeatureInfoRadius() != null ) { featureInfoRadius = sf.getFeatureInfoRadius(); LOG.debug( "Using global feature info radius setting of {}.", featureInfoRadius ); } else { LOG.debug( "Using default feature info radius of {}.", featureInfoRadius ); } return new MapOptions( quali, interpol, alias, maxFeatures, featureInfoRadius ); } return null; }
public int getFeatureInfoRadius( String layer ) { MapOptions opts = options.get( layer ); return opts == null ? -1 : opts.getFeatureInfoRadius(); }
opaque = cfg.isOpaque(); return new MapOptions( quali, interpol, alias, maxFeats, rad, opaque );
public int getMaxFeatures( String layer ) { MapOptions opts = options.get( layer ); return opts == null ? -1 : opts.getMaxFeatures(); }
private void applyAntialias( MapOptions options ) { switch ( options.getAntialias() ) { case IMAGE: graphics.setRenderingHint( KEY_ANTIALIASING, VALUE_ANTIALIAS_ON ); graphics.setRenderingHint( KEY_TEXT_ANTIALIASING, VALUE_TEXT_ANTIALIAS_OFF ); break; case TEXT: graphics.setRenderingHint( KEY_ANTIALIASING, VALUE_ANTIALIAS_OFF ); graphics.setRenderingHint( KEY_TEXT_ANTIALIASING, VALUE_TEXT_ANTIALIAS_ON ); break; case BOTH: graphics.setRenderingHint( KEY_ANTIALIASING, VALUE_ANTIALIAS_ON ); graphics.setRenderingHint( KEY_TEXT_ANTIALIASING, VALUE_TEXT_ANTIALIAS_ON ); break; case NONE: graphics.setRenderingHint( KEY_ANTIALIASING, VALUE_ANTIALIAS_OFF ); graphics.setRenderingHint( KEY_TEXT_ANTIALIASING, VALUE_TEXT_ANTIALIAS_OFF ); break; } }
private static void insertRadius( String layer, MapOptionsMaps options, MapOptions layerDefaults, MapOptions globalDefaults ) { if ( options.getFeatureInfoRadius( layer ) == -1 ) { if ( layerDefaults != null ) { options.setFeatureInfoRadius( layer, layerDefaults.getFeatureInfoRadius() ); } if ( options.getFeatureInfoRadius( layer ) == -1 ) { options.setFeatureInfoRadius( layer, globalDefaults.getFeatureInfoRadius() ); } } }