Java Doc for FeatureTransformer.java in  » GIS » GeoTools-2.4.1 » org » geotools » gml » producer » 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.gml.producer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.xml.transform.TransformerBase
      org.geotools.gml.producer.FeatureTransformer

FeatureTransformer
public class FeatureTransformer extends TransformerBase (Code)
FeatureTransformer provides a mechanism for converting Feature objects into (hopefully) valid gml. This is a work in progress, so please be patient. A simple example of how to use this class follows:
 FeatureCollection collection; // can also use FeatureReader!!
 OutputStream out;
 FeatureTransformer ft = new FeatureTransformer();
 // set the indentation to 4 spaces
 ft.setIndentation(4);
 // this will allow Features with the FeatureType which has the namespace
 // "http://somewhere.org" to be prefixed with xxx...
 ft.getFeatureNamespaces().declarePrefix("xxx","http://somewhere.org");
 // transform
 ft.transform(collection,out);
 
The above example assumes a homogenous collection of Features whose FeatureType has the namespace "http://somewhere.org" but note that not all DataSources currently provide FeatureTypes with a namespace... There are two other mechanisms for prefixing your Features.
1) Map a specific FeatureType by identity to prefix and nsURI
 FeatureType fc;
 FeatureTransformer ft = new FeatureTransformer();
 ft.getFeatureTypeNamespaces().declareNamespace(fc,"xxx","http://somewhere.org");
 
2) Provide a default namespace for any Features whose FeatureType either has an empty namespace, OR, has not been mapped using the previous method. This is basically a catch-all mechanism.
 FeatureTransformer ft = new FeatureTransformer();
 ft.getFeatureTypeNamespaces().declareDefaultNamespace("xxx","http://somewhere.org");
 

The collectionNamespace and prefix property refers to the prefix and namespace given to the document root and defualts to wfs,http://www.opengis.wfs.
author:
   Ian Schneider
author:
   Chris Holmes, TOPP
version:
   $Id: FeatureTransformer.java 29502 2008-02-28 09:06:25Z jgarnett $

Inner Class :public static class FeatureTypeNamespaces
Inner Class :public static class FeatureTranslator extends TranslatorSupport implements FeatureCollectionIteration.Handler



Method Summary
public  voidaddSchemaLocation(String nsURI, String uri)
    
public  org.geotools.xml.transform.TranslatorcreateTranslator(ContentHandler handler)
    
protected  FeatureTranslatorcreateTranslator(ContentHandler handler, String prefix, String ns, FeatureTypeNamespaces featureTypeNamespaces, SchemaLocationSupport schemaLocationSupport)
     Template method for creating the translator.
public  StringgetCollectionNamespace()
    
public  StringgetCollectionPrefix()
    
public  NamespaceSupportgetFeatureNamespaces()
    
public  FeatureTypeNamespacesgetFeatureTypeNamespaces()
    
protected  voidloadGmlAttributes(Set gmlAtts)
     Template method for determining which attributes to prefix with gml.
public  voidsetCollectionNamespace(String nsURI)
    
public  voidsetCollectionPrefix(String prefix)
    
public  voidsetFeatureBounding(boolean featureBounding)
     Sets whether a gml:boundedBy element should automatically be generated and included.
public  voidsetGmlPrefixing(boolean prefixGml)
     If Gml Prefixing is enabled then attributes with names that could be prefixed with gml, such as description, pointProperty, and name, will be.
public  voidsetLockId(String lockId)
     Used to set a lockId attribute after a getFeatureWithLock.
public  voidsetNumDecimals(int numDecimals)
     Sets the number of decimals to be used in the geometry coordinates of the response.
public  voidsetSrsName(String srsName)
     Used to set the srsName attribute of the Geometries to be turned to xml.



Method Detail
addSchemaLocation
public void addSchemaLocation(String nsURI, String uri)(Code)



createTranslator
public org.geotools.xml.transform.Translator createTranslator(ContentHandler handler)(Code)



createTranslator
protected FeatureTranslator createTranslator(ContentHandler handler, String prefix, String ns, FeatureTypeNamespaces featureTypeNamespaces, SchemaLocationSupport schemaLocationSupport)(Code)
Template method for creating the translator.



getCollectionNamespace
public String getCollectionNamespace()(Code)



getCollectionPrefix
public String getCollectionPrefix()(Code)



getFeatureNamespaces
public NamespaceSupport getFeatureNamespaces()(Code)



getFeatureTypeNamespaces
public FeatureTypeNamespaces getFeatureTypeNamespaces()(Code)



loadGmlAttributes
protected void loadGmlAttributes(Set gmlAtts)(Code)
Template method for determining which attributes to prefix with gml.
Parameters:
  gmlAtts - Set of strings corresponding to element names on a type.



setCollectionNamespace
public void setCollectionNamespace(String nsURI)(Code)



setCollectionPrefix
public void setCollectionPrefix(String prefix)(Code)



setFeatureBounding
public void setFeatureBounding(boolean featureBounding)(Code)
Sets whether a gml:boundedBy element should automatically be generated and included. The element will not be updateable, and is simply derived from the geometries present in the feature.

Note that the setGmlPrefixing() interacts with this occasionally, since it will hack in a gml prefix to a boundedBy attribute included in the featureType. If gml prefixing is on, and featureBounding is on, then the bounds from the attribute will be used. If gml prefixing is off, then that boundedBy attribute will presumably be in its own namespace, and so the automatic gml boundedBy will not conflict, so both will be printed, with the automatic one deriving its bounds from the boundedBy attribute and any other geometries in the feature


Parameters:
  featureBounding - true if the bounds of the feature shouldbe automatically calculated and included as a gml:boundedBy inthe gml output. Note this puts a good bit of bandwidth overheadon the output. Default is false



setGmlPrefixing
public void setGmlPrefixing(boolean prefixGml)(Code)
If Gml Prefixing is enabled then attributes with names that could be prefixed with gml, such as description, pointProperty, and name, will be. So if an attribute called name is encountered, instead of prepending the default prefix (say gt2:name), it will turn out as gml:name. Right now this is fairly hacky, as the gml:name, gml:description, ect., should be in the first attributes by default. The actualy geometry encodings will always be prefixed with the proper gml, like gml:coordinates. This only applies to attributes, that could also be part of the features normal schema (for example a pointProperty could be declared in the gt2 namespace, instead of a gml:pointProperty it would be a gt2:pointProperty.
Parameters:
  prefixGml - true if prefixing gml should be enabled.Default is disabled, no gml prefixing.



setLockId
public void setLockId(String lockId)(Code)
Used to set a lockId attribute after a getFeatureWithLock.
Parameters:
  lockId - The lockId of the lock on the WFS.



setNumDecimals
public void setNumDecimals(int numDecimals)(Code)
Sets the number of decimals to be used in the geometry coordinates of the response. This allows for more efficient results, since often the storage format itself won't specify as many decimal places as the response might want. The default is 4, but should generally be set by the user of this class.
Parameters:
  numDecimals - the number of significant digits past the decimal toinclude in the response.



setSrsName
public void setSrsName(String srsName)(Code)
Used to set the srsName attribute of the Geometries to be turned to xml. For now we can only have all with the same srsName.
Parameters:
  srsName - This SRS names hould agree with the GML specification; example "EPSG:4326"



Fields inherited from org.geotools.xml.transform.TransformerBase
final public static String XMLNS_NAMESPACE(Code)(Java Doc)

Methods inherited from org.geotools.xml.transform.TransformerBase
public Task createTransformTask(Object object, StreamResult result) throws TransformerException(Code)(Java Doc)
public Transformer createTransformer() throws TransformerException(Code)(Java Doc)
abstract public Translator createTranslator(ContentHandler handler)(Code)(Java Doc)
public XMLReaderSupport createXMLReader(Object object)(Code)(Java Doc)
public Charset getEncoding()(Code)(Java Doc)
public int getIndentation()(Code)(Java Doc)
public boolean isNamespaceDeclartionEnabled()(Code)(Java Doc)
public boolean isOmitXMLDeclaration()(Code)(Java Doc)
public void setEncoding(Charset charset)(Code)(Java Doc)
public void setIndentation(int amt)(Code)(Java Doc)
public void setNamespaceDeclarationEnabled(boolean enabled)(Code)(Java Doc)
public void setOmitXMLDeclaration(boolean xmlDecl)(Code)(Java Doc)
public void transform(Object object, java.io.OutputStream out) throws TransformerException(Code)(Java Doc)
public void transform(Object object, java.io.Writer out) throws TransformerException(Code)(Java Doc)
public void transform(Object object, StreamResult result) throws TransformerException(Code)(Java Doc)
public String transform(Object object) throws TransformerException(Code)(Java Doc)

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.