Java Doc for GMLReader.java in  » GIS » openjump » com » vividsolutions » jump » 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 » openjump » com.vividsolutions.jump.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.xml.sax.helpers.DefaultHandler
      com.vividsolutions.jump.io.GMLReader

GMLReader
public class GMLReader extends DefaultHandler implements JUMPReader(Code)
GMLReader is a JUMPReader specialized to read GML files.

DataProperties for the JCSReader load(DataProperties) interface:

Parameter Meaning
File or DefaultValue File name for the input .xml file
InputTemplateFile Filename for the GMLInputTemplate .xml file
CompressedFile File name (a .zip or .gz) with a .jml/.xml/.gml inside (specified by File)
CompressedFileTemplateFile name (.zip or .gz) with the input template in (specified by InputTemplateFile)


NOTE: If InputTemplateFile is unspecified, GMLReader will try to read one off the top of the input .xml file (the JCS format). This is the same as specifying the File and TemplateFile to be the same.

Typically, you would write:
 gmlReader = new GMLReader();
 gmlReader.load( DriverProperties) ; // has InputFile and InputTemplate
 
or:
 gmlReader.setInputTemplate( GMLInputTemplate);
 gmlReader.load(  ,  );
 


Internal Details - This is based on a small finite state machine with these states:

STATE MEANING
0 Init
1 Waiting for Collection tag
2 Waiting for Feature tag
3 Getting jcs columns
4 Parsing geometry (goes back to state 3)
1000 Parsing Multi-geometry, recursion level =1
1001 Parsing Multi-geometry, recursion level =2
...


State Diagram

init
 0  ----->  1
 |
 | Collection start Tag
 |
 -->2---------------->     FINISH
 \  |   End Collection tag
 End Feature tag \ |
 \|
 4<-------->3
 Geometry start/end
 

For multi-geometries
On start Multi-geometry, increment state by 1 (or jump to 1000 if at state 4)
make sure recursivegeometry[state-1000] is null


on end multi-geometry,
build geometry in recursivegeometry[state-1000], add it to recursivegeometry[state-1000-1]
state= state-1

For single geometries - they will be stuck into recursivegeometry[0], which is the same
as geometry

For multi geometries - they will also be stuck into recursivegeometry[0], which is the same
as geometry. But, for the first nested geometry, it will be stuck into recursivegeometry[1],
which will then be geometry
 example of double GCs:
 START geometry     ->move to state 4
 START TAG: multi*  -> move to state 1000, geometry = recursivegeometry[0]
 
 -> added to geometry 
 -> added to geometry START TAG: multi* -> move to state 1001, geometry =
 recursivegeometry[1] 
 -> added to geometry 
 -> added to geometry END TAG: multi -> move to state 1000, build geometry in
 recursivegeometry[1], add to recursivegeometry[0], geometry =
 recursivegeometry[0] 
 -> added to geometry END TAG: multi ->  move to state 4, build
 geometry in recursivegeometry[0] (thats the result) and put it in
 finalGeometry END geometry -> add to feature collection example of simple
 geometry: START geometry ->move to state 4 BEGIN polygon ->clear out inner
 ring accumulator BEGIN outerboundary BEGIN linearring END linearring -> put
 points in linearRing END outerboundary -> put linearRing in outerBoundary
 BEGIN innerboundary BEGIN linearring END linearring -> put points in
 linearRing END innerboundary -> add linearRing to innerBoundary list END
 polygon -> build polygon (put in geometry, which is recursivegeometry[0] END
 geometry => add to feature collection
 
Most of the work is done in the endTag method!

New additions: Jan 2005 by Dave Blasby allow srid to be parsed from the GML file For example: .... The SRID of the created geometry will be 42102. It accepts srsNames of the form ":". ie. "EPSG:111" or "DAVE:222" or "BCGOV:333" etc... The Geometry's SRID will be the number. If you have a GEOMETRYCOLLECTION with more than one SRID specified the SRID of the result will be indeterminate (this isnt correct GML). Geometries without a srsName will get SRID 0. This functionality defaults to off for compatibility. To turn it on or off, call the acceptSRID(true|false) function. New Addition: Jan, 2005by Dave Blasby Added slightly better support for type=OBJECT. It sticks a String in. Before it would probably throw an error. Added support for multi-objects for example: ...1... ...2... ...3... Old behavior would be to for column 'b' to have value "...3...". New behavior (only if you set b's type to 'OBJECT' and set the GMLReader to processMultiItems as lists) ...1... --> b get the string "...1..." (as before) ...1......2......3... --> 'b' is a list of String ['...1...','...2...','...3...']


Field Summary
 GMLInputTemplateGMLinput
    
 intSRID
    
 intSTATE
    
static  intSTATE_GET_COLUMNS
    
static  intSTATE_INIT
    
static  intSTATE_PARSE_GEOM_NESTED
    
static  intSTATE_PARSE_GEOM_SIMPLE
    
static  intSTATE_WAIT_COLLECTION_TAG
    
static  intSTATE_WAIT_FEATURE_TAG
    
 Pointapoint
    
 FeaturecurrentFeature
    
 intcurrentGeometryNumb
    
 FeatureCollectionfc
    
 FeatureSchemafcmd
    
 GeometryfinalGeometry
    
 ArrayListgeometry
    
 GeometryFactorygeometryFactory
    
 ArrayListinnerBoundaries
    
 AttributeslastStartTag_atts
    
 StringlastStartTag_name
    
 StringlastStartTag_qName
    
 StringlastStartTag_uri
    
 LineStringlineString
    
 LinearRinglinearRing
    
public  booleanmultiItemsAsLists
    
 LinearRingouterBoundary
    
public  booleanparseSRID
    
 ArrayListpointList
    
 Polygonpolygon
    
 ArrayListrecursivegeometry
    
 CoordinatesingleCoordinate
    
 StringstreamName
    
 StringBuffertagBody
    
 XMLReaderxr
    

Constructor Summary
public  GMLReader()
     Constructor - make a SAXParser and have this GMLReader be its ContentHandler and ErrorHandler.

Method Summary
public  voidacceptSRID(boolean parseTheSRID)
    
public  voidcharacters(char[] ch, int start, int length)
    
public  voidendDocument()
    
public  voidendElement(String uri, String name, String qName)
     SAX handler - handle state information and transitions based on ending elements Most of the work of the parser is done here.
public  voiderror(SAXParseException exception)
    
public  voidfatalError(SAXParseException exception)
    
public  voidprocessMultiItems(boolean accept)
     Added slightly better support for type=OBJECT.
public  FeatureCollectionread(DriverProperties dp)
    
public  FeatureCollectionread(java.io.Reader r)
     Helper function - calls read(java.io.Reader r,String readerName) with the readerName "Unknown Stream".
public  FeatureCollectionread(java.io.Reader r, String readerName)
     Main function to read a GML file.
public  voidsetInputTemplate(GMLInputTemplate template)
     Attach a GMLInputTemplate information class.
public  voidstartDocument()
    
public  voidstartElement(String uri, String name, String qName, Attributes atts)
     SAX handler.
public  voidwarning(SAXParseException exception)
    

Field Detail
GMLinput
GMLInputTemplate GMLinput(Code)



SRID
int SRID(Code)



STATE
int STATE(Code)



STATE_GET_COLUMNS
static int STATE_GET_COLUMNS(Code)



STATE_INIT
static int STATE_INIT(Code)
STATE MEANING
0 Init
1 Waiting for Collection tag
2 Waiting for Feature tag
3 Getting jcs columns
4 Parsing geometry (goes back to state 3)
1000 Parsing Multi-geometry, recursion level =1
1001 Parsing Multi-geometry, recursion level =2



STATE_PARSE_GEOM_NESTED
static int STATE_PARSE_GEOM_NESTED(Code)



STATE_PARSE_GEOM_SIMPLE
static int STATE_PARSE_GEOM_SIMPLE(Code)



STATE_WAIT_COLLECTION_TAG
static int STATE_WAIT_COLLECTION_TAG(Code)



STATE_WAIT_FEATURE_TAG
static int STATE_WAIT_FEATURE_TAG(Code)



apoint
Point apoint(Code)



currentFeature
Feature currentFeature(Code)



currentGeometryNumb
int currentGeometryNumb(Code)



fc
FeatureCollection fc(Code)



fcmd
FeatureSchema fcmd(Code)



finalGeometry
Geometry finalGeometry(Code)



geometry
ArrayList geometry(Code)



geometryFactory
GeometryFactory geometryFactory(Code)



innerBoundaries
ArrayList innerBoundaries(Code)



lastStartTag_atts
Attributes lastStartTag_atts(Code)



lastStartTag_name
String lastStartTag_name(Code)



lastStartTag_qName
String lastStartTag_qName(Code)



lastStartTag_uri
String lastStartTag_uri(Code)



lineString
LineString lineString(Code)



linearRing
LinearRing linearRing(Code)



multiItemsAsLists
public boolean multiItemsAsLists(Code)
true => for 'OBJECT' types, if you find more than 1 item, make a list and store all the results



outerBoundary
LinearRing outerBoundary(Code)



parseSRID
public boolean parseSRID(Code)



pointList
ArrayList pointList(Code)



polygon
Polygon polygon(Code)



recursivegeometry
ArrayList recursivegeometry(Code)



singleCoordinate
Coordinate singleCoordinate(Code)



streamName
String streamName(Code)



tagBody
StringBuffer tagBody(Code)



xr
XMLReader xr(Code)




Constructor Detail
GMLReader
public GMLReader()(Code)
Constructor - make a SAXParser and have this GMLReader be its ContentHandler and ErrorHandler.




Method Detail
acceptSRID
public void acceptSRID(boolean parseTheSRID)(Code)
parse SRID information in geometry tags
Parameters:
  parseTheSRID - true = parse



characters
public void characters(char[] ch, int start, int length) throws SAXException(Code)
SAX handler - store and accumulate tag bodies
Parameters:
  ch - Description of the Parameter
Parameters:
  start - Description of the Parameter
Parameters:
  length - Description of the Parameter
exception:
  SAXException - Description of the Exception



endDocument
public void endDocument()(Code)
SAX HANDLER - move to state 0



endElement
public void endElement(String uri, String name, String qName) throws SAXException(Code)
SAX handler - handle state information and transitions based on ending elements Most of the work of the parser is done here.
Parameters:
  uri - Description of the Parameter
Parameters:
  name - Description of the Parameter
Parameters:
  qName - Description of the Parameter
exception:
  SAXException - Description of the Exception



error
public void error(SAXParseException exception) throws SAXException(Code)



fatalError
public void fatalError(SAXParseException exception) throws SAXException(Code)



processMultiItems
public void processMultiItems(boolean accept)(Code)
Added slightly better support for type=OBJECT. It sticks a String in. Before it would probably throw an error. Added support for multi-objects for example: ...1... ...2... ...3... Old behavior would be to for column 'b' to have value "...3...". New behavior (only if you set b's type to 'OBJECT' and set the GMLReader to processMultiItems as lists) ...1... --> b get the string "b" (as before) ...1......2......3... --> 'b' is a list of String ['...1...','...2...','...3...']



read
public FeatureCollection read(DriverProperties dp) throws IllegalParametersException, Exception(Code)
Main Entry - load in a GML file
Parameters:
  dp - Description of the Parameter Description of the Return Value
exception:
  IllegalParametersException - Description of the Exception
exception:
  Exception - Description of the Exception



read
public FeatureCollection read(java.io.Reader r) throws Exception(Code)
Helper function - calls read(java.io.Reader r,String readerName) with the readerName "Unknown Stream". You should have already called setInputTempalate().
Parameters:
  r - reader to read the GML File from Description of the Return Value
exception:
  Exception - Description of the Exception



read
public FeatureCollection read(java.io.Reader r, String readerName) throws Exception(Code)
Main function to read a GML file. You should have already called setInputTempalate().
Parameters:
  r - reader to read the GML File from
Parameters:
  readerName - what to call the reader for error reporting Description of the Return Value
exception:
  Exception - Description of the Exception



setInputTemplate
public void setInputTemplate(GMLInputTemplate template)(Code)
Attach a GMLInputTemplate information class.
Parameters:
  template - The new inputTemplate value



startDocument
public void startDocument()(Code)
SAX handler - move to state 1



startElement
public void startElement(String uri, String name, String qName, Attributes atts) throws SAXException(Code)
SAX handler. Handle state and state transitions based on an element starting
Parameters:
  uri - Description of the Parameter
Parameters:
  name - Description of the Parameter
Parameters:
  qName - Description of the Parameter
Parameters:
  atts - Description of the Parameter
exception:
  SAXException - Description of the Exception



warning
public void warning(SAXParseException exception) throws SAXException(Code)



Methods inherited from org.xml.sax.helpers.DefaultHandler
public void characters(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void endDocument() throws SAXException(Code)(Java Doc)
public void endElement(String uri, String localName, String qName) throws SAXException(Code)(Java Doc)
public void endPrefixMapping(String prefix) throws SAXException(Code)(Java Doc)
public void error(SAXParseException e) throws SAXException(Code)(Java Doc)
public void fatalError(SAXParseException e) throws SAXException(Code)(Java Doc)
public void ignorableWhitespace(char ch, int start, int length) throws SAXException(Code)(Java Doc)
public void notationDecl(String name, String publicId, String systemId) throws SAXException(Code)(Java Doc)
public void processingInstruction(String target, String data) throws SAXException(Code)(Java Doc)
public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException(Code)(Java Doc)
public void setDocumentLocator(Locator locator)(Code)(Java Doc)
public void skippedEntity(String name) throws SAXException(Code)(Java Doc)
public void startDocument() throws SAXException(Code)(Java Doc)
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException(Code)(Java Doc)
public void startPrefixMapping(String prefix, String uri) throws SAXException(Code)(Java Doc)
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException(Code)(Java Doc)
public void warning(SAXParseException e) throws SAXException(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.