Java Doc for PaletteFactory.java in  » GIS » GeoTools-2.4.1 » org » geotools » image » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.image.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.image.io.PaletteFactory

PaletteFactory
public class PaletteFactory (Code)
A factory for created from RGB values listed in files. The palette definition files are text files containing an arbitrary number of lines, each line containing RGB components ranging from 0 to 255 inclusive. An optional fourth column may be provided for alpha components. Empty lines and lines starting with the '#' character are ignored. Example:
 # RGB codes for SeaWiFs images
 # (chlorophylle-a concentration)
 033   000   096
 032   000   097
 031   000   099
 030   000   101
 029   000   102
 028   000   104
 026   000   106
 025   000   107
 etc...
 
The number of RGB codes doesn't have to match the target . RGB codes will be automatically interpolated as needed.
since:
   2.1
version:
   $Id: PaletteFactory.java 27848 2007-11-12 13:10:32Z desruisseaux $
author:
   Martin Desruisseaux


Field Summary
final  SetprotectedPalettes
     The set of palettes protected from garbage collection.

Constructor Summary
public  PaletteFactory(PaletteFactory fallback, ClassLoader loader, File directory, String extension, Charset charset, Locale locale)
     Constructs a palette factory using an optional for loading palette definition files.
Parameters:
  fallback - An optional fallback factory, or null if there is none.
public  PaletteFactory(PaletteFactory fallback, Class loader, File directory, String extension, Charset charset, Locale locale)
     Constructs a palette factory using an optional for loading palette definition files.

Method Summary
public  String[]getAvailableNames()
     Returns the list of available palette names.
public  Color[]getColors(URL url)
     Load colors from an URL.
Parameters:
  url - The palette's URL.
public  Color[]getColors(String name)
     Loads colors from a definition file.
public  PalettegetContinuousPalette(String name, float minimum, float maximum, int dataType, int numBands, int visibleBand)
     Creates a palette suitable for floating point values.
public static synchronized  PaletteFactorygetDefault()
     Gets the default palette factory.
final  IndexedResourceBundlegetErrorResources()
     Returns the resources for formatting error messages.
public  IndexColorModelgetIndexColorModel(String name)
     Loads an index color model from a definition file. The returned model will use index from 0 to 255 inclusive.
Parameters:
  name - The palette's name to load.
public  IndexColorModelgetIndexColorModel(String name, int lower, int upper)
     Loads an index color model from a definition file. The returned model will use index from lower inclusive to upper exclusive.
public  PalettegetPalette(String name, int size)
     Returns the palette of the specified name and size.
public  PalettegetPalette(String name, int lower, int upper, int size, int numBands, int visibleBand)
     Returns the palette of the specified name and size.
public  PalettegetPalettePadValueFirst(String name, int size)
     Returns a palette with a pad value at index 0.
Parameters:
  name - The palette's name to load.
Parameters:
  size - The size.
public  PalettegetPalettePadValueLast(String name, int size)
     Returns a palette with pad value at the last index.
Parameters:
  name - The palette's name to load.
Parameters:
  size - The size.
protected  InputStreamgetResourceAsStream(String name)
     Returns an input stream for reading the specified resource.
public  LocalegetWarningLocale()
     Returns the locale set by the last invocation to PaletteFactory.setWarningLocale in the current thread.
public static synchronized  voidscanForPlugins(ClassLoader loader)
     Lookups for additional palette factories on the classpath.
public synchronized  voidsetWarningLocale(Locale warningLocale)
     Sets the locale to use for formatting warning or error messages.

Field Detail
protectedPalettes
final Set protectedPalettes(Code)
The set of palettes protected from garbage collection. We protect a palette as long as it holds a reference to a color model - this is necessary in order to prevent multiple creation of the same IndexColorModel . The references are cleaned by PaletteDisposer .




Constructor Detail
PaletteFactory
public PaletteFactory(PaletteFactory fallback, ClassLoader loader, File directory, String extension, Charset charset, Locale locale)(Code)
Constructs a palette factory using an optional for loading palette definition files.
Parameters:
  fallback - An optional fallback factory, or null if there is none. The fallbackfactory will be queried if a palette was not found in the current factory.
Parameters:
  loader - An optional class loader to use for loading the palette definition files.If null , loading will occurs from the system current workingdirectory.
Parameters:
  directory - The base directory for palette definition files. It may be a Java packageif a loader were specified. If null , then "." isassumed.
Parameters:
  extension - File name extension, or null if there is no extensionto add to filename. If non-null, this extension will be automaticallyappended to filename. It should starts with the '.' character.
Parameters:
  charset - The charset to use for parsing files, or null for the default.
Parameters:
  locale - The locale to use for parsing files, or null for the default.



PaletteFactory
public PaletteFactory(PaletteFactory fallback, Class loader, File directory, String extension, Charset charset, Locale locale)(Code)
Constructs a palette factory using an optional for loading palette definition files. Using a instead of a can avoid security issue on some platforms (some platforms do not allow to load resources from a ClassLoader because it can load from the root package).
Parameters:
  fallback - An optional fallback factory, or null if there is none. The fallbackfactory will be queried if a palette was not found in the current factory.
Parameters:
  loader - An optional class to use for loading the palette definition files.If null , loading will occurs from the system current workingdirectory.
Parameters:
  directory - The base directory for palette definition files. It may be a Java packageif a loader were specified. If null , then "." isassumed.
Parameters:
  extension - File name extension, or null if there is no extensionto add to filename. If non-null, this extension will be automaticallyappended to filename. It should starts with the '.' character.
Parameters:
  charset - The charset to use for parsing files, or null for the default.
Parameters:
  locale - The locale to use for parsing files. or null for the default.
since:
   2.2




Method Detail
getAvailableNames
public String[] getAvailableNames()(Code)
Returns the list of available palette names. Any item in this list can be specified as argument to PaletteFactory.getPalette . The list of available palette name, or null if this methodis unable to fetch this information.



getColors
public Color[] getColors(URL url) throws IOException(Code)
Load colors from an URL.
Parameters:
  url - The palette's URL. The set of colors, or null if the set was not found.
throws:
  IOException - if an error occurs during reading.
throws:
  IIOException - if an error occurs during parsing. PaletteFactory PaletteFactory



getColors
public Color[] getColors(String name) throws IOException(Code)
Loads colors from a definition file. If no colors were found in the current palette factory and a fallback was specified at construction time, then the fallback will be queried.
Parameters:
  name - The palette's name to load. This name doesn't need to contains a pathor an extension. Path and extension are set according value specifiedat construction time. The set of colors, or null if the set was not found.
throws:
  IOException - if an error occurs during reading.
throws:
  IIOException - if an error occurs during parsing.



getContinuousPalette
public Palette getContinuousPalette(String name, float minimum, float maximum, int dataType, int numBands, int visibleBand)(Code)
Creates a palette suitable for floating point values.
Parameters:
  name - The palette name.
Parameters:
  minimum - The minimal sample value expected.
Parameters:
  maximum - The maximal sample value expected.
Parameters:
  dataType - The data type as a DataBuffer.TYPE_FLOATor DataBuffer.TYPE_DOUBLE constant.
Parameters:
  numBands - The number of bands (usually 1).
Parameters:
  visibleBand - The band to use for color computations (usually 0).
since:
   2.4



getDefault
public static synchronized PaletteFactory getDefault()(Code)
Gets the default palette factory. This method creates a default instance looking for org/geotools/image/io/colors/*.pal files where '*' is a palette name. Next, this method using the default class loader. The result is cached for subsequent calls to this getDefault() method.



getErrorResources
final IndexedResourceBundle getErrorResources()(Code)
Returns the resources for formatting error messages.



getIndexColorModel
public IndexColorModel getIndexColorModel(String name) throws IOException(Code)
Loads an index color model from a definition file. The returned model will use index from 0 to 255 inclusive.
Parameters:
  name - The palette's name to load. This name doesn't need to contains a pathor an extension. Path and extension are set according value specifiedat construction time. The index color model, or null if the palettes was not found.
throws:
  IOException - if an error occurs during reading.
throws:
  IIOException - if an error occurs during parsing.Palette.getColorModel



getIndexColorModel
public IndexColorModel getIndexColorModel(String name, int lower, int upper) throws IOException(Code)
Loads an index color model from a definition file. The returned model will use index from lower inclusive to upper exclusive. Other index will have a transparent color.
Parameters:
  name - The palette's name to load. This name doesn't need to contains a pathor an extension. Path and extension are set according value specifiedat construction time.
Parameters:
  lower - Palette's lower index (inclusive).
Parameters:
  upper - Palette's upper index (exclusive). The index color model, or null if the palettes was not found.
throws:
  IOException - if an error occurs during reading.
throws:
  IIOException - if an error occurs during parsing.
since:
   2.3Palette.getColorModel



getPalette
public Palette getPalette(String name, int size)(Code)
Returns the palette of the specified name and size. The palette's name doesn't need to contains a directory path or an extension. Path and extension are set according values specified at construction time.
Parameters:
  name - The palette's name to load.
Parameters:
  size - The size. The palette.
since:
   2.4



getPalette
public Palette getPalette(String name, int lower, int upper, int size, int numBands, int visibleBand)(Code)
Returns the palette of the specified name and size. The RGB colors will be distributed in the range lower inclusive to upper exclusive. Remaining pixel values (if any) will be left to a black or transparent color by default.

The palette's name doesn't need to contains a directory path or an extension. Path and extension are set according values specified at construction time.
Parameters:
  name - The palette's name to load.
Parameters:
  lower - Index of the first valid element (inclusive) in the to be created.
Parameters:
  upper - Index of the last valid element (exclusive) in the to be created.
Parameters:
  size - The size of the to be created.This is the value to be returned by IndexColorModel.getMapSize.
Parameters:
  numBands - The number of bands (usually 1).
Parameters:
  visibleBand - The band to use for color computations (usually 0). The palette.
since:
   2.4




getPalettePadValueFirst
public Palette getPalettePadValueFirst(String name, int size)(Code)
Returns a palette with a pad value at index 0.
Parameters:
  name - The palette's name to load.
Parameters:
  size - The size. The palette.
since:
   2.4



getPalettePadValueLast
public Palette getPalettePadValueLast(String name, int size)(Code)
Returns a palette with pad value at the last index.
Parameters:
  name - The palette's name to load.
Parameters:
  size - The size. The palette.
since:
   2.4



getResourceAsStream
protected InputStream getResourceAsStream(String name)(Code)
Returns an input stream for reading the specified resource. The default implementation delegates to the Class.getResourceAsStream(String) Class or ClassLoader.getResourceAsStream(String) ClassLoader method of the same name, according the loader argument type given to the constructor. Subclasses may override this method if a more elaborated mechanism is wanted for fetching resources. This is sometime required in the context of applications using particular class loaders.
Parameters:
  name - The name of the resource to load, constructed as directory + name + extension where directory and extension werespecified to the constructor, while name was given to thePaletteFactory.getPalette method. The input stream, or null if the resources was not found.
since:
   2.3



getWarningLocale
public Locale getWarningLocale()(Code)
Returns the locale set by the last invocation to PaletteFactory.setWarningLocale in the current thread.
since:
   2.4



scanForPlugins
public static synchronized void scanForPlugins(ClassLoader loader)(Code)
Lookups for additional palette factories on the classpath. The palette factories shall be declared in META-INF/services/org.geotools.image.io.PaletteFactory files.

Palette factories found are added to the chain of default factories. The next time that a .getPalette(...) method will be invoked, the scanned factories will be tried first. If they can't create a given palette, then the Geotools default factory will be tried last.

It is usually not needed to invoke this method directly since it is invoked automatically by PaletteFactory.getDefault() when first needed. This method may be useful when a specific class loader need to be used, or when the classpath content changed.
Parameters:
  loader - The class loader to use, or null for the default one.
since:
   2.4




setWarningLocale
public synchronized void setWarningLocale(Locale warningLocale)(Code)
Sets the locale to use for formatting warning or error messages. This is typically the . This locale is informative only; there is no garantee that this locale will be really used.

This method sets the locale for the current thread only. It is safe to use this palette factory concurrently in many threads, each with their own locale.
Parameters:
  warningLocale - The locale for warning or error messages, or null for thedefault locale
since:
   2.4




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.