Source Code Cross Referenced for WktGeOxygene.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » util » conversion » 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 » GeOxygene 1.3 » fr.ign.cogit.geoxygene.util.conversion 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the GeOxygene project source files. 
003:         * 
004:         * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for 
005:         * the development and deployment of geographic (GIS) applications. It is a open source 
006:         * contribution of the COGIT laboratory at the Institut Géographique National (the French 
007:         * National Mapping Agency).
008:         * 
009:         * See: http://oxygene-project.sourceforge.net 
010:         *  
011:         * Copyright (C) 2005 Institut Géographique National
012:         *
013:         * This library is free software; you can redistribute it and/or modify it under the terms
014:         * of the GNU Lesser General Public License as published by the Free Software Foundation; 
015:         * either version 2.1 of the License, or any later version.
016:         *
017:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY 
018:         * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
019:         * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser General Public License along with 
022:         * this library (see file LICENSE if present); if not, write to the Free Software 
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:         *  
025:         */
026:
027:        /* Generated By:JavaCC: Do not edit this line. WktGeOxygene.java */
028:        package fr.ign.cogit.geoxygene.util.conversion;
029:
030:        import java.io.BufferedReader;
031:        import java.io.ByteArrayInputStream;
032:        import java.io.File;
033:        import java.io.FileInputStream;
034:        import java.io.FileNotFoundException;
035:        import java.io.FileOutputStream;
036:        import java.io.IOException;
037:        import java.io.InputStream;
038:        import java.io.InputStreamReader;
039:        import java.io.OutputStream;
040:        import java.io.PrintStream;
041:        import java.util.ArrayList;
042:        import java.util.Iterator;
043:        import java.util.List;
044:        import java.util.StringTokenizer;
045:
046:        import fr.ign.cogit.geoxygene.spatial.coordgeom.DirectPosition;
047:        import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_LineString;
048:        import fr.ign.cogit.geoxygene.spatial.coordgeom.GM_Polygon;
049:        import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_Aggregate;
050:        import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_MultiCurve;
051:        import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_MultiPoint;
052:        import fr.ign.cogit.geoxygene.spatial.geomaggr.GM_MultiSurface;
053:        import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Curve;
054:        import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Point;
055:        import fr.ign.cogit.geoxygene.spatial.geomprim.GM_Ring;
056:        import fr.ign.cogit.geoxygene.spatial.geomroot.GM_Object;
057:
058:        public class WktGeOxygene implements  WktGeOxygeneConstants {
059:            static class EndOfFile extends Exception {
060:            }
061:
062:            static class EmptyLine extends Exception {
063:            }
064:
065:            /*-----------------------------------------------------*/
066:            /*- Create Wkt object(s) from GM_Object ---------------*/
067:            /*-----------------------------------------------------*/
068:
069:            /*- GM_Aggregate --------------------------------------*/
070:
071:            static String geometryCollectionTaggedText(GM_Aggregate aggregate) {
072:                StringBuffer result = new StringBuffer();
073:                result.append("GEOMETRYCOLLECTION ");
074:                if (IsEmptyUtil.isEmpty(aggregate))
075:                    result.append("EMPTY");
076:                else {
077:                    result.append("(");
078:                    for (int i = 0; i < aggregate.size(); i++) {
079:                        if (i != 0)
080:                            result.append(", ");
081:                        result.append(makeWkt(aggregate.get(i)));
082:                    }
083:                    result.append(")");
084:                }
085:                return result.toString();
086:            }
087:
088:            /*- GM_MultiPoint -------------------------------------*/
089:
090:            static String multiPointTaggedText(GM_MultiPoint multiPoint) {
091:                GM_Point point;
092:                StringBuffer result = new StringBuffer();
093:                result.append("MULTIPOINT ");
094:                if (IsEmptyUtil.isEmpty(multiPoint))
095:                    result.append("EMPTY");
096:                else {
097:                    result.append("(");
098:                    for (int i = 0; i < multiPoint.size(); i++) {
099:                        point = (GM_Point) multiPoint.get(i);
100:                        if (i != 0)
101:                            result.append(", ");
102:                        result.append(point(point));
103:                    }
104:                    result.append(")");
105:                }
106:                return result.toString();
107:            }
108:
109:            /*- GM_MultiCurve -------------------------------------*/
110:
111:            static String multiLineStringTaggedText(GM_MultiCurve multiCurve) {
112:                GM_LineString lineString;
113:                StringBuffer result = new StringBuffer();
114:                result.append("MULTILINESTRING ");
115:                if (IsEmptyUtil.isEmpty(multiCurve))
116:                    result.append("EMPTY");
117:                else {
118:                    result.append("(");
119:                    for (int i = 0; i < multiCurve.size(); i++) {
120:                        lineString = (GM_LineString) multiCurve.get(i);
121:                        if (i != 0)
122:                            result.append(", ");
123:                        result.append(lineStringText(lineString));
124:                    }
125:                    result.append(")");
126:                }
127:                return result.toString();
128:            }
129:
130:            /*- GM_MultiSurface -----------------------------------*/
131:
132:            static String multiPolygon(GM_MultiSurface multiSurface) {
133:                StringBuffer result = new StringBuffer();
134:                for (int i = 0; i < multiSurface.size(); i++) {
135:                    GM_Object surface;
136:                    surface = multiSurface.get(i);
137:                    if (i != 0)
138:                        result.append(", ");
139:                    if (surface instanceof  GM_Polygon)
140:                        result.append(polygonText((GM_Polygon) surface));
141:                    else if (surface instanceof  GM_MultiSurface)
142:                        result.append(multiPolygon((GM_MultiSurface) surface));
143:                }
144:                return result.toString();
145:            }
146:
147:            static String multiPolygonText(GM_MultiSurface multiSurface) {
148:                StringBuffer result = new StringBuffer();
149:                result.append("(");
150:                result.append(multiPolygon(multiSurface));
151:                result.append(")");
152:                return result.toString();
153:            }
154:
155:            static String multiPolygonTaggedText(GM_MultiSurface multiSurface) {
156:                StringBuffer result = new StringBuffer();
157:                result.append("MULTIPOLYGON ");
158:                if (IsEmptyUtil.isEmpty(multiSurface))
159:                    result.append("EMPTY");
160:                else {
161:                    result.append(multiPolygonText(multiSurface));
162:                }
163:                return result.toString();
164:            }
165:
166:            /*- GM_LineString -------------------------------------*/
167:
168:            static String lineStringText(GM_LineString lineString) {
169:                GM_Point point;
170:                StringBuffer result = new StringBuffer();
171:                result.append("(");
172:                for (int i = 0; i < lineString.sizeControlPoint(); i++) {
173:                    point = (GM_Point) new GM_Point(lineString
174:                            .getControlPoint(i));
175:                    if (i != 0)
176:                        result.append(", ");
177:                    result.append(point(point));
178:                }
179:                result.append(")");
180:                return result.toString();
181:            }
182:
183:            static String lineStringTaggedText(GM_LineString lineString) {
184:                StringBuffer result = new StringBuffer();
185:                result.append("LINESTRING ");
186:                if (IsEmptyUtil.isEmpty(lineString))
187:                    result.append("EMPTY");
188:                else
189:                    result.append(lineStringText(lineString));
190:
191:                return result.toString();
192:            }
193:
194:            /*- GM_Polygon ----------------------------------------*/
195:
196:            static String polygonText(GM_Polygon polygon) {
197:                GM_LineString lineString;
198:                GM_Curve prim;
199:
200:                StringBuffer result = new StringBuffer();
201:                result.append("(");
202:
203:                lineString = polygon.exteriorLineString();
204:                result.append(lineStringText(lineString));
205:
206:                for (int i = 0; i < polygon.sizeInterior(); i++) {
207:                    lineString = polygon.interiorLineString(i);
208:                    result.append(", ");
209:                    result.append(lineStringText(lineString));
210:                }
211:                result.append(")");
212:                return result.toString();
213:            }
214:
215:            static String polygonTaggedText(GM_Polygon polygon) {
216:                StringBuffer result = new StringBuffer();
217:                result.append("POLYGON ");
218:                if (IsEmptyUtil.isEmpty(polygon))
219:                    result.append("EMPTY");
220:                else
221:                    result.append(polygonText(polygon));
222:                return result.toString();
223:            }
224:
225:            /*- GM_Point ------------------------------------------*/
226:
227:            static String point(GM_Point point) {
228:                DirectPosition position = point.getPosition();
229:                StringBuffer result = new StringBuffer();
230:                result.append(position.getX());
231:                result.append(" ");
232:                result.append(position.getY());
233:                return result.toString();
234:            }
235:
236:            static String pointText(GM_Point point) {
237:                StringBuffer result = new StringBuffer();
238:                result.append("(");
239:                result.append(point(point));
240:                result.append(")");
241:                return result.toString();
242:            }
243:
244:            static String pointTaggedText(GM_Point point) {
245:                StringBuffer result = new StringBuffer();
246:                result.append("POINT ");
247:                if (IsEmptyUtil.isEmpty(point))
248:                    result.append("EMPTY");
249:                else
250:                    result.append(pointText(point));
251:                return result.toString();
252:            }
253:
254:            /*- GM_Object -----------------------------------------*/
255:
256:            public static String makeWkt(GM_Object object) {
257:                String result = "POINT EMPTY";
258:                if (object instanceof  GM_Point)
259:                    result = pointTaggedText((GM_Point) object);
260:                else if (object instanceof  GM_MultiSurface)
261:                    result = multiPolygonTaggedText((GM_MultiSurface) object);
262:                else if (object instanceof  GM_MultiCurve)
263:                    result = multiLineStringTaggedText((GM_MultiCurve) object);
264:                else if (object instanceof  GM_MultiPoint)
265:                    result = multiPointTaggedText((GM_MultiPoint) object);
266:                else if (object instanceof  GM_Polygon)
267:                    result = polygonTaggedText((GM_Polygon) object);
268:                else if (object instanceof  GM_LineString)
269:                    result = lineStringTaggedText((GM_LineString) object);
270:                else if (object instanceof  GM_Aggregate)
271:                    result = geometryCollectionTaggedText((GM_Aggregate) object);
272:                return result;
273:            }
274:
275:            public static String makeWkt(List geomList) {
276:                StringBuffer result = new StringBuffer();
277:                Iterator i = geomList.iterator();
278:                while (i.hasNext()) {
279:                    GM_Object geom = (GM_Object) i.next();
280:                    String wkt = makeWkt(geom);
281:                    result.append(wkt);
282:                    result.append('\n');
283:                }
284:                return result.toString();
285:            }
286:
287:            /*- Read from stream ----------------------------------*/
288:
289:            public static GM_Object readGeOxygeneFromWkt(BufferedReader in)
290:                    throws IOException, ParseException {
291:                String wkt = in.readLine();
292:                return makeGeOxygene(wkt);
293:            }
294:
295:            public static GM_Object readGeOxygeneFromWkt(InputStream in)
296:                    throws IOException, ParseException {
297:                return readGeOxygeneFromWkt(new BufferedReader(
298:                        new InputStreamReader(in)));
299:            }
300:
301:            public static GM_Object readGeOxygeneFromWkt(String path)
302:                    throws FileNotFoundException, IOException, ParseException {
303:                return readGeOxygeneFromWkt(new FileInputStream(path));
304:            }
305:
306:            /*- Write to stream -----------------------------------*/
307:
308:            public static void writeWkt(String path, boolean append,
309:                    GM_Object geom) throws IOException {
310:                writeWkt(new FileOutputStream(path, append), geom);
311:            }
312:
313:            public static void writeWkt(OutputStream out, GM_Object geom)
314:                    throws IOException {
315:                new PrintStream(out).println(makeWkt(geom));
316:            }
317:
318:            public static void writeWkt(OutputStream out, List geomList)
319:                    throws IOException {
320:                Iterator i = geomList.iterator();
321:                while (i.hasNext()) {
322:                    GM_Object geom = (GM_Object) i.next();
323:                    writeWkt(out, geom);
324:                }
325:            }
326:
327:            /*-----------------------------------------------------*/
328:            /*- Create GM_Object from Wkt object(s) ---------------*/
329:            /*-----------------------------------------------------*/
330:
331:            public static List makeGeOxygeneList(String inStrArray[])
332:                    throws ParseException {
333:                ArrayList list = new ArrayList();
334:                for (int i = 0; i < inStrArray.length; i++) {
335:                    list.add(makeGeOxygene(inStrArray[i]));
336:                }
337:                return list;
338:            }
339:
340:            static GM_Object makeGeOxygene(InputStream in)
341:                    throws ParseException {
342:                WktGeOxygene parser = new WktGeOxygene(in);
343:                GM_Object geom = null;
344:
345:                try {
346:                    geom = parser.parseOneLine();
347:                } catch (EndOfFile x) {
348:                } catch (EmptyLine x) {
349:                }
350:
351:                return geom;
352:            }
353:
354:            public static List makeGeOxygeneList(File file) throws Exception {
355:                return makeGeOxygeneList(new FileInputStream(file));
356:            }
357:
358:            public static List makeGeOxygeneList(String wkt) throws Exception {
359:                InputStream in = new ByteArrayInputStream(wkt.getBytes());
360:                return makeGeOxygeneList(in);
361:            }
362:
363:            public static List makeGeOxygeneList(InputStream in)
364:                    throws ParseException {
365:                ArrayList list = new ArrayList();
366:                WktGeOxygene parser = new WktGeOxygene(in);
367:
368:                while (true) {
369:                    try {
370:                        GM_Object geom = parser.parseOneLine();
371:                        list.add(geom);
372:                    } catch (EndOfFile x) {
373:                        break;
374:                    } catch (EmptyLine x) {
375:                    }
376:                }
377:                return list;
378:            }
379:
380:            public static GM_Object makeGeOxygene(String inStr)
381:                    throws ParseException {
382:                InputStream in = new ByteArrayInputStream(inStr.getBytes());
383:                return makeGeOxygene(in);
384:            }
385:
386:            final public DirectPosition point() throws ParseException {
387:                DirectPosition p;
388:                Token xy;
389:                xy = jj_consume_token(POINT);
390:                StringTokenizer tkz = new StringTokenizer(xy.image);
391:                String xStr = tkz.nextToken();
392:                String yStr = tkz.nextToken();
393:                p = new DirectPosition(Double.parseDouble(xStr), Double
394:                        .parseDouble(yStr));
395:                {
396:                    if (true)
397:                        return p;
398:                }
399:                throw new Error("Missing return statement in function");
400:            }
401:
402:            final public DirectPosition pointText() throws ParseException {
403:                DirectPosition p = new DirectPosition();
404:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
405:                case 9:
406:                    jj_consume_token(9);
407:                    p = point();
408:                    jj_consume_token(10);
409:                    break;
410:                case 11:
411:                    jj_consume_token(11);
412:                    break;
413:                default:
414:                    jj_la1[0] = jj_gen;
415:                    jj_consume_token(-1);
416:                    throw new ParseException();
417:                }
418:                {
419:                    if (true)
420:                        return p;
421:                }
422:                throw new Error("Missing return statement in function");
423:            }
424:
425:            final public GM_LineString linestringText() throws ParseException {
426:                GM_LineString lineString = new GM_LineString();
427:                DirectPosition p;
428:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
429:                case 9:
430:                    jj_consume_token(9);
431:                    p = point();
432:                    lineString.addControlPoint(p);
433:                    label_1: while (true) {
434:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
435:                        case 12:
436:                            ;
437:                            break;
438:                        default:
439:                            jj_la1[1] = jj_gen;
440:                            break label_1;
441:                        }
442:                        jj_consume_token(12);
443:                        p = point();
444:                        lineString.addControlPoint(p);
445:                    }
446:                    jj_consume_token(10);
447:                    break;
448:                case 11:
449:                    jj_consume_token(11);
450:                    break;
451:                default:
452:                    jj_la1[2] = jj_gen;
453:                    jj_consume_token(-1);
454:                    throw new ParseException();
455:                }
456:                {
457:                    if (true)
458:                        return lineString;
459:                }
460:                throw new Error("Missing return statement in function");
461:            }
462:
463:            final public GM_Polygon polygonText() throws ParseException {
464:                GM_Polygon polygon = new GM_Polygon();
465:                GM_LineString lineString;
466:                DirectPosition start;
467:                DirectPosition end;
468:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
469:                case 9:
470:                    jj_consume_token(9);
471:                    lineString = linestringText();
472:                    polygon = new GM_Polygon(lineString);
473:                    label_2: while (true) {
474:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
475:                        case 12:
476:                            ;
477:                            break;
478:                        default:
479:                            jj_la1[3] = jj_gen;
480:                            break label_2;
481:                        }
482:                        jj_consume_token(12);
483:                        lineString = linestringText();
484:                        polygon.addInterior(new GM_Ring(lineString));
485:                    }
486:                    jj_consume_token(10);
487:                    break;
488:                case 11:
489:                    jj_consume_token(11);
490:                    break;
491:                default:
492:                    jj_la1[4] = jj_gen;
493:                    jj_consume_token(-1);
494:                    throw new ParseException();
495:                }
496:                {
497:                    if (true)
498:                        return polygon;
499:                }
500:                throw new Error("Missing return statement in function");
501:            }
502:
503:            final public GM_MultiPoint multipointText() throws ParseException {
504:                GM_MultiPoint multiPoint = new GM_MultiPoint();
505:                DirectPosition p;
506:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
507:                case 9:
508:                    jj_consume_token(9);
509:                    p = point();
510:                    multiPoint.add(new GM_Point(p));
511:                    label_3: while (true) {
512:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
513:                        case 12:
514:                            ;
515:                            break;
516:                        default:
517:                            jj_la1[5] = jj_gen;
518:                            break label_3;
519:                        }
520:                        jj_consume_token(12);
521:                        p = point();
522:                        multiPoint.add(new GM_Point(p));
523:                    }
524:                    jj_consume_token(10);
525:                    break;
526:                case 11:
527:                    jj_consume_token(11);
528:                    break;
529:                default:
530:                    jj_la1[6] = jj_gen;
531:                    jj_consume_token(-1);
532:                    throw new ParseException();
533:                }
534:                {
535:                    if (true)
536:                        return multiPoint;
537:                }
538:                throw new Error("Missing return statement in function");
539:            }
540:
541:            final public GM_MultiCurve multilinestringText()
542:                    throws ParseException {
543:                GM_MultiCurve multiLineString = new GM_MultiCurve();
544:                GM_LineString lineString;
545:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
546:                case 9:
547:                    jj_consume_token(9);
548:                    lineString = linestringText();
549:                    multiLineString.add(lineString);
550:                    label_4: while (true) {
551:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
552:                        case 12:
553:                            ;
554:                            break;
555:                        default:
556:                            jj_la1[7] = jj_gen;
557:                            break label_4;
558:                        }
559:                        jj_consume_token(12);
560:                        lineString = linestringText();
561:                        multiLineString.add(lineString);
562:                    }
563:                    jj_consume_token(10);
564:                    break;
565:                case 11:
566:                    jj_consume_token(11);
567:                    break;
568:                default:
569:                    jj_la1[8] = jj_gen;
570:                    jj_consume_token(-1);
571:                    throw new ParseException();
572:                }
573:                {
574:                    if (true)
575:                        return multiLineString;
576:                }
577:                throw new Error("Missing return statement in function");
578:            }
579:
580:            final public GM_MultiSurface multipolygonText()
581:                    throws ParseException {
582:                GM_MultiSurface multiPolygon = new GM_MultiSurface();
583:                GM_Polygon polygon;
584:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
585:                case 9:
586:                    jj_consume_token(9);
587:                    polygon = polygonText();
588:                    multiPolygon.add(polygon);
589:                    label_5: while (true) {
590:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
591:                        case 12:
592:                            ;
593:                            break;
594:                        default:
595:                            jj_la1[9] = jj_gen;
596:                            break label_5;
597:                        }
598:                        jj_consume_token(12);
599:                        polygon = polygonText();
600:                        multiPolygon.add(polygon);
601:                    }
602:                    jj_consume_token(10);
603:                    break;
604:                case 11:
605:                    jj_consume_token(11);
606:                    break;
607:                default:
608:                    jj_la1[10] = jj_gen;
609:                    jj_consume_token(-1);
610:                    throw new ParseException();
611:                }
612:                {
613:                    if (true)
614:                        return multiPolygon;
615:                }
616:                throw new Error("Missing return statement in function");
617:            }
618:
619:            final public GM_Aggregate geometrycollectionText()
620:                    throws ParseException {
621:                GM_Aggregate geometryCollection = new GM_Aggregate();
622:                GM_Object geometry;
623:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
624:                case 9:
625:                    jj_consume_token(9);
626:                    geometry = geometryTaggedText();
627:                    geometryCollection.add(geometry);
628:                    label_6: while (true) {
629:                        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
630:                        case 12:
631:                            ;
632:                            break;
633:                        default:
634:                            jj_la1[11] = jj_gen;
635:                            break label_6;
636:                        }
637:                        jj_consume_token(12);
638:                        geometry = geometryTaggedText();
639:                        geometryCollection.add(geometry);
640:                    }
641:                    jj_consume_token(10);
642:                    break;
643:                case 11:
644:                    jj_consume_token(11);
645:                    break;
646:                default:
647:                    jj_la1[12] = jj_gen;
648:                    jj_consume_token(-1);
649:                    throw new ParseException();
650:                }
651:                {
652:                    if (true)
653:                        return geometryCollection;
654:                }
655:                throw new Error("Missing return statement in function");
656:            }
657:
658:            final public GM_Point pointTaggedText() throws ParseException {
659:                DirectPosition p;
660:                jj_consume_token(13);
661:                p = pointText();
662:                {
663:                    if (true)
664:                        return new GM_Point(p);
665:                }
666:                throw new Error("Missing return statement in function");
667:            }
668:
669:            final public GM_MultiPoint multipointTaggedText()
670:                    throws ParseException {
671:                GM_MultiPoint mp;
672:                jj_consume_token(14);
673:                mp = multipointText();
674:                {
675:                    if (true)
676:                        return mp;
677:                }
678:                throw new Error("Missing return statement in function");
679:            }
680:
681:            final public GM_LineString linestringTaggedText()
682:                    throws ParseException {
683:                GM_LineString lineString;
684:                jj_consume_token(15);
685:                lineString = linestringText();
686:                {
687:                    if (true)
688:                        return lineString;
689:                }
690:                throw new Error("Missing return statement in function");
691:            }
692:
693:            final public GM_MultiCurve multilinestringTaggedText()
694:                    throws ParseException {
695:                GM_MultiCurve multiLineString;
696:                jj_consume_token(16);
697:                multiLineString = multilinestringText();
698:                {
699:                    if (true)
700:                        return multiLineString;
701:                }
702:                throw new Error("Missing return statement in function");
703:            }
704:
705:            final public GM_Polygon polygonTaggedText() throws ParseException {
706:                GM_Polygon poly;
707:                jj_consume_token(17);
708:                poly = polygonText();
709:                {
710:                    if (true)
711:                        return poly;
712:                }
713:                throw new Error("Missing return statement in function");
714:            }
715:
716:            final public GM_MultiSurface multipolygonTaggedText()
717:                    throws ParseException {
718:                GM_MultiSurface mp;
719:                jj_consume_token(18);
720:                mp = multipolygonText();
721:                {
722:                    if (true)
723:                        return mp;
724:                }
725:                throw new Error("Missing return statement in function");
726:            }
727:
728:            final public GM_Aggregate geometrycollectionTaggedText()
729:                    throws ParseException {
730:                GM_Aggregate o;
731:                jj_consume_token(19);
732:                o = geometrycollectionText();
733:                {
734:                    if (true)
735:                        return o;
736:                }
737:                throw new Error("Missing return statement in function");
738:            }
739:
740:            final public GM_Object geometryTaggedText() throws ParseException {
741:                GM_Object o;
742:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
743:                case 13:
744:                    o = pointTaggedText();
745:                    break;
746:                case 15:
747:                    o = linestringTaggedText();
748:                    break;
749:                case 17:
750:                    o = polygonTaggedText();
751:                    break;
752:                case 14:
753:                    o = multipointTaggedText();
754:                    break;
755:                case 16:
756:                    o = multilinestringTaggedText();
757:                    break;
758:                case 18:
759:                    o = multipolygonTaggedText();
760:                    break;
761:                case 19:
762:                    o = geometrycollectionTaggedText();
763:                    break;
764:                default:
765:                    jj_la1[13] = jj_gen;
766:                    jj_consume_token(-1);
767:                    throw new ParseException();
768:                }
769:                {
770:                    if (true)
771:                        return o;
772:                }
773:                throw new Error("Missing return statement in function");
774:            }
775:
776:            final public GM_Object parseOneLine() throws ParseException,
777:                    EmptyLine, EndOfFile {
778:                GM_Object o;
779:                switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
780:                case 13:
781:                case 14:
782:                case 15:
783:                case 16:
784:                case 17:
785:                case 18:
786:                case 19:
787:                    o = geometryTaggedText();
788:                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
789:                    case EOL:
790:                        jj_consume_token(EOL);
791:                        break;
792:                    case 0:
793:                        jj_consume_token(0);
794:                        break;
795:                    default:
796:                        jj_la1[14] = jj_gen;
797:                        jj_consume_token(-1);
798:                        throw new ParseException();
799:                    }
800:                    {
801:                        if (true)
802:                            return o;
803:                    }
804:                    break;
805:                case EOL:
806:                    jj_consume_token(EOL);
807:                    {
808:                        if (true)
809:                            throw new EmptyLine();
810:                    }
811:                    {
812:                        if (true)
813:                            return null;
814:                    }
815:                    break;
816:                case 0:
817:                    jj_consume_token(0);
818:                    {
819:                        if (true)
820:                            throw new EndOfFile();
821:                    }
822:                    {
823:                        if (true)
824:                            return null;
825:                    }
826:                    break;
827:                default:
828:                    jj_la1[15] = jj_gen;
829:                    jj_consume_token(-1);
830:                    throw new ParseException();
831:                }
832:                throw new Error("Missing return statement in function");
833:            }
834:
835:            public WktGeOxygeneTokenManager token_source;
836:            SimpleCharStream jj_input_stream;
837:            public Token token, jj_nt;
838:            private int jj_ntk;
839:            private int jj_gen;
840:            final private int[] jj_la1 = new int[16];
841:            final private int[] jj_la1_0 = { 0xa00, 0x1000, 0xa00, 0x1000,
842:                    0xa00, 0x1000, 0xa00, 0x1000, 0xa00, 0x1000, 0xa00, 0x1000,
843:                    0xa00, 0xfe000, 0x41, 0xfe041, };
844:
845:            public WktGeOxygene(java.io.InputStream stream) {
846:                jj_input_stream = new SimpleCharStream(stream, 1, 1);
847:                token_source = new WktGeOxygeneTokenManager(jj_input_stream);
848:                token = new Token();
849:                jj_ntk = -1;
850:                jj_gen = 0;
851:                for (int i = 0; i < 16; i++)
852:                    jj_la1[i] = -1;
853:            }
854:
855:            public void ReInit(java.io.InputStream stream) {
856:                jj_input_stream.ReInit(stream, 1, 1);
857:                token_source.ReInit(jj_input_stream);
858:                token = new Token();
859:                jj_ntk = -1;
860:                jj_gen = 0;
861:                for (int i = 0; i < 16; i++)
862:                    jj_la1[i] = -1;
863:            }
864:
865:            public WktGeOxygene(java.io.Reader stream) {
866:                jj_input_stream = new SimpleCharStream(stream, 1, 1);
867:                token_source = new WktGeOxygeneTokenManager(jj_input_stream);
868:                token = new Token();
869:                jj_ntk = -1;
870:                jj_gen = 0;
871:                for (int i = 0; i < 16; i++)
872:                    jj_la1[i] = -1;
873:            }
874:
875:            public void ReInit(java.io.Reader stream) {
876:                jj_input_stream.ReInit(stream, 1, 1);
877:                token_source.ReInit(jj_input_stream);
878:                token = new Token();
879:                jj_ntk = -1;
880:                jj_gen = 0;
881:                for (int i = 0; i < 16; i++)
882:                    jj_la1[i] = -1;
883:            }
884:
885:            public WktGeOxygene(WktGeOxygeneTokenManager tm) {
886:                token_source = tm;
887:                token = new Token();
888:                jj_ntk = -1;
889:                jj_gen = 0;
890:                for (int i = 0; i < 16; i++)
891:                    jj_la1[i] = -1;
892:            }
893:
894:            public void ReInit(WktGeOxygeneTokenManager tm) {
895:                token_source = tm;
896:                token = new Token();
897:                jj_ntk = -1;
898:                jj_gen = 0;
899:                for (int i = 0; i < 16; i++)
900:                    jj_la1[i] = -1;
901:            }
902:
903:            final private Token jj_consume_token(int kind)
904:                    throws ParseException {
905:                Token oldToken;
906:                if ((oldToken = token).next != null)
907:                    token = token.next;
908:                else
909:                    token = token.next = token_source.getNextToken();
910:                jj_ntk = -1;
911:                if (token.kind == kind) {
912:                    jj_gen++;
913:                    return token;
914:                }
915:                token = oldToken;
916:                jj_kind = kind;
917:                throw generateParseException();
918:            }
919:
920:            final public Token getNextToken() {
921:                if (token.next != null)
922:                    token = token.next;
923:                else
924:                    token = token.next = token_source.getNextToken();
925:                jj_ntk = -1;
926:                jj_gen++;
927:                return token;
928:            }
929:
930:            final public Token getToken(int index) {
931:                Token t = token;
932:                for (int i = 0; i < index; i++) {
933:                    if (t.next != null)
934:                        t = t.next;
935:                    else
936:                        t = t.next = token_source.getNextToken();
937:                }
938:                return t;
939:            }
940:
941:            final private int jj_ntk() {
942:                if ((jj_nt = token.next) == null)
943:                    return (jj_ntk = (token.next = token_source.getNextToken()).kind);
944:                else
945:                    return (jj_ntk = jj_nt.kind);
946:            }
947:
948:            private java.util.Vector jj_expentries = new java.util.Vector();
949:            private int[] jj_expentry;
950:            private int jj_kind = -1;
951:
952:            final public ParseException generateParseException() {
953:                jj_expentries.removeAllElements();
954:                boolean[] la1tokens = new boolean[20];
955:                for (int i = 0; i < 20; i++) {
956:                    la1tokens[i] = false;
957:                }
958:                if (jj_kind >= 0) {
959:                    la1tokens[jj_kind] = true;
960:                    jj_kind = -1;
961:                }
962:                for (int i = 0; i < 16; i++) {
963:                    if (jj_la1[i] == jj_gen) {
964:                        for (int j = 0; j < 32; j++) {
965:                            if ((jj_la1_0[i] & (1 << j)) != 0) {
966:                                la1tokens[j] = true;
967:                            }
968:                        }
969:                    }
970:                }
971:                for (int i = 0; i < 20; i++) {
972:                    if (la1tokens[i]) {
973:                        jj_expentry = new int[1];
974:                        jj_expentry[0] = i;
975:                        jj_expentries.addElement(jj_expentry);
976:                    }
977:                }
978:                int[][] exptokseq = new int[jj_expentries.size()][];
979:                for (int i = 0; i < jj_expentries.size(); i++) {
980:                    exptokseq[i] = (int[]) jj_expentries.elementAt(i);
981:                }
982:                return new ParseException(token, exptokseq, tokenImage);
983:            }
984:
985:            final public void enable_tracing() {
986:            }
987:
988:            final public void disable_tracing() {
989:            }
990:
991:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.