# HG changeset patch # User Thomas Arendsen Hein # Date 1348827288 -7200 # Node ID 69d19995bc3c78bb33142be79a5989093682153f # Parent 4adc35aa655c6574af8fbb4afe7e0ebe9e64a27a# Parent b9a99fcc78c319126f76e50a0152caab26e964b9 merged flys-backend/2.9.1 diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/ChangeLog --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/ChangeLog Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,3627 @@ +2012-09-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/BedHeightEpoch.java: + Corrected broken loop to find epochs for river and km range. + + * src/main/java/de/intevation/flys/model/BedHeightSingle.java: + Corrected broken loop to find singles for river and km range. + +2012-09-12 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java: + Made code more robust. + +2012-09-12 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/Config.java: + Add system property 'flys.backend.importer.skip.default' + which enables the switching of the skipping default. + Very useful if you want only some sub systems by + setting this to 'true' and the sub systems to 'false'. + +2012-09-12 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Indices on cross sections + were created too early (before the referenced tables + were created). + +2012-09-12 Björn Ricks + + * src/main/java/de/intevation/flys/model/River.java: + Add new method determineMinMaxQ to fetch the mimimum and maximum q values + from the database. + +2012-09-10 Sascha L. Teichmann + + * postgresql-minfo.sql: Added missing tables. + * oracle-minfo.sql: Fixed small typos. + +2012-09-10 Sascha L. Teichmann + + * pom.xml: Java 1.6 -> 1.6 + + * src/main/java/de/intevation/flys/utils/StringUtil.java: + Replaced german comment (with an ill encoded Umlaut). + +2012-09-10 Christian Lins + + * src/main/java/de/intevation/flys/model/Gauge.java: + Remove obsolet method (#851). + +2012-09-10 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java: + We need min/max Q, too. + +2012-09-10 Björn Ricks + + * src/main/java/de/intevation/flys/model/MinMaxWQ.java, + src/main/java/de/intevation/flys/model/Gauge.java: + Add method fetchMinMaxWQ to Gauge. This mehtod returns a new MinMaxWQ + instance that contains the fetched values for the gauge overview info. + +2012-09-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java: + Moved some code over from flys-artifacts. + +2012-09-07 Ingo Weinzierl + + Tagged module as '2.9'. + +2012-09-07 Björn Ricks + + * src/main/java/de/intevation/flys/model/Gauge.java: + Rename getDurationCurveData to fetchDurationCurveData to satisfy + hibernate. + +2012-09-06 Björn Ricks + + * src/main/java/de/intevation/flys/model/Gauge.java: + Move static getDurationCurveData method from flys-artifacts + MainValuesFactory class to a instance method in Gauge class. + +2012-08-30 Felix Wolfsteller + + Attempt fix for issue821 (cross sections just till +/-500m). + + * src/main/java/de/intevation/flys/model/CrossSectionLine.java: + Set max value for cross sections to 2500 instead of 500. + +2012-08-30 Ingo Weinzierl + + * contrib/run_geo.sh: New run script for the python based geo importer. + + * contrib/run_hydr_morph.sh: New run script for the java based importer + for hydrological and morphological data. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/overview.tex: Fixed typo. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-geodaesie.tex, + doc/documentation/de/importer-hydr-morph.tex: Corrected name of run + scripts. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-geodaesie.tex, + doc/documentation/de/importer-hydr-morph.tex, + doc/documentation/de/importer-manual.tex: Bugfixes and new geo error + description. + +2012-08-30 Ingo Weinzierl + + * contrib/shpimporter/importer.py: Fixed broken method call. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/overview.tex: Hint to root permissions. + +2012-08-30 Ingo Weinzierl + + * contrib/shpimporter/importer.py: Set 'path' attribute for each feature. + + * contrib/shpimporter/axis.py: Also accept shapes with 'achse' in its name. + + * doc/schema/oracle-spatial.sql: Added 'path' attribute to each db + relation. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-geodaesie.tex: Bugfixes and added hint. + + * doc/documentation/de/importer-manual.tex: Set document revision and + date. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-hydr-morph.tex: Added manual line breaks. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-hydr-morph.tex: Fixed bug during PDF + creation. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-hydr-morph.tex: Bugfixes. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/overview.tex: Improved description of database + schema creation. Describe command to unpack importer tarball. + +2012-08-30 Ingo Weinzierl + + * doc/documentation/de/importer-geodaesie.tex: Added further error message + if no connection to Oracle database could be established. + +2012-08-29 Ingo Weinzierl + + * doc/documentation/de/importer-geodaesie.tex: Documented install steps + for Oracle Instantclient and python and gdal. + +2012-08-27 Ingo Weinzierl + + * doc/documentation/de/importer-hydr-morph.tex: Describe Log4J + configuration; some smaller bugfixes. + +2012-08-27 Ingo Weinzierl + + * doc/documentation/de/overview.tex: Added comment to directory structure + of a river. + + * doc/documentation/de/importer-hydr-morph.tex: Describe import of + morphological files. + +2012-08-27 Ingo Weinzierl + + * doc/documentation/de/title.tex, + doc/documentation/de/overview.tex, + doc/documentation/de/importer-hydr-morph.tex, + doc/documentation/de/importer-manual.tex: Smaller fixed and structural + changes. + +2012-08-27 Ingo Weinzierl + + * doc/documentation/de/importer-hydr-morph.tex: Added documentation from + README. + +2012-08-27 Sascha L. Teichmann + + * doc/README.txt: Documented which hydrological files are taken into account. + +2012-08-26 Sascha L. Teichmann + + * doc/README.txt: Documented the classification of the annotations. + +2012-08-26 Sascha L. Teichmann + + * doc/README.txt: Documented the db credentials. + +2012-08-24 Sascha L. Teichmann + + * doc/README.txt: Completed the error messages (Puh!) + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java, + src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java, + src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java, + src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java, + src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java, + src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java, + src/main/java/de/intevation/flys/importer/parsers/AnnotationClassifier.java, + src/main/java/de/intevation/flys/importer/parsers/WstParser.java, + src/main/java/de/intevation/flys/importer/ImportSQRelation.java: + Made error messages identifiable. + +2012-08-24 Ingo Weinzierl + + * doc/shapeimporter, + doc/shapeimporter/documentation.txt: Removed. The documentation is now + written in latex. + + * doc/documentation, + doc/documentation/de: New. The place where the german documentation is + located. + + * doc/documentation/de/title.tex, + doc/documentation/de/importer-geodaesie.tex, + doc/documentation/de/figures/bfg_logo.png, + doc/documentation/de/figures/intevation-logo.pdf, + doc/documentation/de/overview.tex, + doc/documentation/de/importer-hydr-morph.tex, + doc/documentation/de/importer-manual.tex: German documentation of the + importer and shape importer. + + * doc/documentation/de/Makefile: Makefile to generate the documentation. + + * doc/documentation/de/README: Instructions to generate the documentation. + +2012-08-23 Sascha L. Teichmann + + * doc/README.txt: Added warning messages. TODO: More warnings. + + * src/main/java/de/intevation/flys/importer/parsers/PRFParser.java, + src/main/java/de/intevation/flys/importer/parsers/StaFileParser.java, + src/main/java/de/intevation/flys/importer/parsers/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/parsers/AtFileParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Made warnings identifiable. + +2012-08-23 Sascha L. Teichmann + + * doc/README.txt: Added error messages. + + * src/main/java/de/intevation/flys/importer/Importer.java, + src/main/java/de/intevation/flys/importer/parsers/PRFParser.java + src/main/java/de/intevation/flys/importer/parsers/HYKParser.java + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Made errors identifiable. + +2012-08-23 Sascha L. Teichmann + + * doc/README.txt: Documentation for the importer (german). + TODO: db crendentials, warning & errors, annotation types. + +2012-08-22 Ingo Weinzierl + + * contrib/shpimporter/run.sh: Moved 'SKIP_XXX' variables to the top of + the script. + +2012-08-22 Ingo Weinzierl + + * contrib/shpimporter/axis.py: Use log methods of shpimporter and + removed print() calls. + + * contrib/shpimporter/importer.py: Evaluate command line option 'dry_run'. + Do not commit database transaction if it is activated. + + * contrib/shpimporter/shpimporter.py: Added new command line option + 'dry_run' to supress database transactions. + +2012-08-22 Ingo Weinzierl + + * contrib/shpimporter/shpimporter.py: Use OptionParse to read command line + options. Now, it is no longer necessary to adjust user specific settings + in python files. Users should adapt run.sh script for specific settings. + + * contrib/shpimporter/catchments.py, + contrib/shpimporter/boundaries.py, + contrib/shpimporter/hws.py, + contrib/shpimporter/importer.py, + contrib/shpimporter/uesg.py, + contrib/shpimporter/axis.py, + contrib/shpimporter/km.py, + contrib/shpimporter/floodplains.py, + contrib/shpimporter/lines.py, + contrib/shpimporter/gauges.py, + contrib/shpimporter/buildings.py, + contrib/shpimporter/fixpoints.py, + contrib/shpimporter/crosssectiontracks.py: Added new method getName(). + + * contrib/shpimporter/utils.py: Use shpimporter functions to print debug + messages. + + * contrib/shpimporter/run.sh: New shell script to run the shape importer + with a default configuration. + +2012-08-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/FastAnnotations.java: + Added toString() to Annotation. + +2012-07-27 Ingo Weinzierl + + Tagged module as '2.8.1'. + +2012-07-18 Felix Wolfsteller + + * doc/schema/postgresql.sql, doc/schema/oracle.sql: + Adjusted the official_lines views to include wst column pos. + +2012-07-16 Ingo Weinzierl + + * Tagged module as '2.8'. + +2012-07-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java, + src/main/java/de/intevation/flys/backend/SpatialInfo.java: + Removed same package imports. + +2012-07-12 Sascha L. Teichmann + + * src/main/java/de/intevation/hibernate/MapResultTransformer.java: + Added static INSTANCE because its stateless. + +2012-07-12 Sascha L. Teichmann + + * src/main/java/de/intevation/hibernate/MapResultTransformer.java: + Strategy to directly transform native SQL results into Maps. + +2012-07-11 Sascha L. Teichmann + + Fix for flys/issue359 + + * src/main/java/de/intevation/flys/importer/parsers/PRFParser.java: + Removed extension from PRF descriptions. + +2012-07-11 Sascha L. Teichmann + + * doc/schema/postgresql.sql, doc/schema/oracle.sql: + Added indices for fasten access to cross section points. + +2012-07-11 Sascha L. Teichmann + + Partial fix for flys/issue697 + + * doc/schema/oracle.sql: Increased the decimal places of Ws, Qs and Kms to 5. + +2012-07-03 Ingo Weinzierl + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Set correct connection provider class (its package has changed in the + last commit). + +2012-07-03 Ingo Weinzierl + + * src/main/java/de/intevation/flys/utils/DBCPConnectionProvider.java: + Fixed broken package declaration. + +2012-06-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql, doc/schema/oracle.sql: + Added views to access the 'Amtlichen Linien'. + +2012-06-15 Sascha L. Teichmann + + * src/main/java/de/intevation/**/*.java: Removed trailing whitespace. + +2012-06-14 Sascha L. Teichmann + + Make access to SedDB configurable over conf.xml and provide + access to sessions. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Moved FLYS specific stuff out into the concept of credential classes + which provides the user, password, dialect, driver, url and the + Hibernate classes to bind. + + * src/main/java/de/intevation/flys/backend/Credentials.java: New. + Abstact class to provide the data needed for the SessionFactoryProvider. + + * src/main/java/de/intevation/flys/backend/FLYSCredentials.java: New. + Extends Credentials to serve the FLYS specific stuff. + + * src/main/java/de/intevation/flys/backend/SedDBCredentials.java: New. + Extends Credentials to serve the SedDB specific stuff. The parameters + are drawn from conf.xml in the form: + + + ... + + USER + PASSWORD + DRIVER + URL + DIALECT + + ... + + + If absent defaults are: + - user: seddb + - password: seddb + - driver: org.postgresql.Driver + - url: jdbc:postgresql://localhost:5432/seddb + - dialect: org.hibernate.dialect.PostgreSQLDialect + + Defaults can be overwritten with system properties: + - user: flys.seddb.user + - password: flys.seddb.password + - driver: flys.seddb.driver + - url: flys.seddb.url + - dialect: flys.seddb.dialect + + * src/main/java/de/intevation/flys/backend/SedDBSessionHolder.java: New. + Use this if you want to establish a session to the SedDB! + Works like the SessionHolder. + + * src/main/java/de/intevation/flys/backend/SessionHolder.java: + Add Override annotation. This holder gives you a session + to the FLYS database. + + * src/main/java/de/intevation/flys/App.java: Adjusted. + +2012-06-14 Sascha L. Teichmann + + * src/main/java/de/intevation/seddb/model/*.java: Hibernate access to + SedDB generated by Eclipse (ugly formatted, but compiles). + +2012-06-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java: + Re-establish cross platform compatibilty again. + +2012-06-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/CrossSectionTrack.java: Added the + missing 'name' property and added a function that returns all + CrossSectionTracks of a specific river with a specific name. + +2012-06-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added missing river_id column to + sq_relation table and reordered the drop statements. + + * src/main/java/de/intevation/flys/model/SQRelationValue.java, + src/main/java/de/intevation/flys/model/SQRelation.java: Added missing + constructors and fixed some minor bugs that occured during import test. + + * src/main/java/de/intevation/flys/importer/ImportSQRelationValue.java, + src/main/java/de/intevation/flys/importer/ImportSQRelation.java: + Implemented code to store sq relations and values into db. + + * src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java: + Override parse() to retrieve the filename. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Implemented + code to store sq relations into db. + +2012-06-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportSQRelationValue.java, + src/main/java/de/intevation/flys/importer/ImportSQRelation.java: + New classes used during the import process of MINFO sq relations. + + * src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java: + New line parser that reads MINFO specifc sq relation files. + + * src/main/java/de/intevation/flys/importer/Config.java: Added system + property to skip parsing sq relations. + + "-Dflys.backend.importer.skip.sq.relation" + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Parse MINFO + sq relations. + +2012-06-12 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Cleared some + irritating debug statements. + +2012-06-12 Ingo Weinzierl + + * doc/annotation-types.xml: Added regex to match "Geschiebemesstellen" as + "Messstelle" type. + + * src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java: + Parse KM files in "../Morphologie/Streckendaten/". On Windows Systems, + this won't work! + +2012-06-11 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/FastAnnotations.java: + Added Override annotation to new NameFilter. + +2012-06-11 Raimund Renkert + + * src/main/java/de/intevation/flys/model/FastAnnotations.java: + Added filter for annotation names. + +2012-06-08 Felix Wolfsteller + + * src/main/java/de/intevation/flys/model/FastAnnotations.java: + Fix comment. + +2012-06-08 Felix Wolfsteller + + * src/main/java/de/intevation/flys/model/SQRelationValue.java: + Fix hibernaty annotation symptom (make it run again). + +2012-06-07 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Schema additions for MINFO s/q + relation. + + * src/main/java/de/intevation/flys/model/SQRelationValue.java, + src/main/java/de/intevation/flys/model/SQRelation.java: New model + classes for MINFO s/q relation. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes. + +2012-06-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/GaugeLocation.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Removed superfluous imports. + +2012-05-27 Ingo Weinzierl + + * Tagged module as '2.7'. + +2012-05-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/BedHeightEpoch.java, + src/main/java/de/intevation/flys/model/BedHeightSingle.java: Added lower + and upper km to function that returns all singles and epochs for a given + river. + +2012-05-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/BedHeightSingleValue.java: Fixed + a typo. + +2012-05-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/BedHeightSingleValue.java, + src/main/java/de/intevation/flys/model/BedHeightEpochValue.java: Added + functions to retrieve single and epoch values based on its owner and km + range. + +2012-05-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/BedHeightEpoch.java, + src/main/java/de/intevation/flys/model/BedHeightSingle.java: Added + functions to get singles and epochs by river and by id. + +2012-05-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/FlowVelocityModel.java, + src/main/java/de/intevation/flys/model/FlowVelocityModelValue.java, + src/main/java/de/intevation/flys/model/DischargeZone.java: Added static + functions to retrieve data from database. + +2012-05-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/DischargeZone.java: Added a + function getDischargeZones() that returns all DischargeZones for a given + river. + +2012-05-10 Ingo Weinzierl + + * contrib/shpimporter/gauges.py: Search for field 'MPNAAM' and use its + value as name for the geometry. + + * src/main/java/de/intevation/flys/model/GaugeLocation.java: New model + class for storing locations of gauges. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered GaugeLocation class. + +2012-05-10 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/HydrBoundary.java, + src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java: New. + Hydrological boundaries. + + * src/main/java/de/intevation/flys/model/Line.java: Modified signature of + Line.getLines(). It now also takes the name of a line to retrieve more + specific lines. + + * src/main/java/de/intevation/flys/model/Building.java: Modified signature + of Building.getBuildings(). It now also takes the name of a building to + retrieve more specific lines. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered HydrBoundary and HydrBoundaryPoly classes. + +2012-05-10 Ingo Weinzierl + + * contrib/shpimporter/crosssectiontracks.py: Search for 'STATION' field in + shapefile to extract the current km. + +2012-05-08 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Hws.java: The getHws() function + got a further parameter 'name' to retrieve specific hws only. + + +2012-05-08 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Catchment.java: The + getCatchments() function got a further parameter 'name' to retrieve + specific catchments only. + +2012-05-08 Ingo Weinzierl + + * doc/schema/oracle-spatial_idx.sql: Set the geometry type of 'catchments' + to 'multipolygon'. + + * src/main/java/de/intevation/flys/model/Catchment.java: The geometry + attribute in such instances is now from type 'Geometry'. + +2012-05-08 Ingo Weinzierl + + * doc/schema/import-dems.sql: New. Insert statements to insert dems into + database. + +2012-05-04 Ingo Weinzierl + + * doc/schema/oracle-drop-spatial.sql, + doc/schema/oracle-spatial.sql: New relation 'gauge_location' and some + bugfixes in the drop schema. + + * contrib/shpimporter/catchments.py, + contrib/shpimporter/hws.py, + contrib/shpimporter/gauges.py: New importers. + + * contrib/shpimporter/importer.py: Added a debug statement to improve the + visibility of the log output. + + * contrib/shpimporter/shpimporter.py: Make use of the new importers. + + +2012-05-03 Ingo Weinzierl + + * doc/schema/oracle-drop-spatial.sql, + doc/schema/oracle-spatial.sql: Added new relations for hydrological + boundaries and appended a 'name' field to relations that had no such + field yet. + + * contrib/shpimporter/floodplains.py, + contrib/shpimporter/boundaries.py: New importers for floodplain and + hydrological boundaries. + + * contrib/shpimporter/lines.py, + contrib/shpimporter/buildings.py, + contrib/shpimporter/uesg.py, + contrib/shpimporter/fixpoints.py, + contrib/shpimporter/axis.py, + contrib/shpimporter/crosssectiontracks.py, + contrib/shpimporter/km.py: Set the 'name' attribute for new features. + + * contrib/shpimporter/importer.py: Some bugfixes and improvements: + geometries are transformed into a destination coordinate system now. + + * contrib/shpimporter/shpimporter.py: Use all importers and defined the + destination srs. + +2012-05-02 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/FastCrossSectionLine.java, + src/main/java/de/intevation/flys/model/CrossSectionPoint.java, + src/main/java/de/intevation/flys/model/CrossSectionLine.java, + src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Store meassure points of profiles as Doubles not as BigDecimal. + This should save a lot of memory during the import. + +2012-04-27 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceValue.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceColumn.java: + Removed superfluous imports. + +2012-04-27 Sascha L. Teichmann + + * doc/schema/postgresql-minfo.sql: Adjusted PostgreSQL port + to match the Oracle schema. + +2012-04-27 Ingo Weinzierl + + * doc/annotation-types.xml: Adapted annotation typed based on BfG wishes. + +2012-04-27 Ingo Weinzierl + + * doc/schema/oracle-drop.sql: New SQL file to drop WINFO specific db + schema. + +2012-04-27 Ingo Weinzierl + + * doc/schema/oracle.sql: Made SQL instructions upper case. + +2012-04-27 Ingo Weinzierl + + * doc/schema/oracle-drop-spatial.sql: New statements to drop the whole + spatial schema. + +2012-04-27 Ingo Weinzierl + + * contrib/shpimporter/lines.py, + contrib/shpimporter/buildings.py, + contrib/shpimporter/importer.py, + contrib/shpimporter/fixpoints.py, + contrib/shpimporter/axis.py, + contrib/shpimporter/crosssectiontracks.py, + contrib/shpimporter/km.py: New classes for importing specific + shapefiles. Each of this imports defines its target db tablename and a + directory path to the shapefiles it should import. + + * contrib/shpimporter/uesg.py: Some modifications necessary to streamline + the import process of shapefiles. + + * contrib/shpimporter/shpimporter.py: Use all available imports for the + import process. + +2012-04-26 Ingo Weinzierl + + * doc/schema/oracle-spatial.sql: Repaired broken schema. + +2012-04-26 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added a config + option to skip parsing MINFO waterlevel differences: + + -Dflys.backend.importer.skip.waterlevel.differences=True + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Parse and + store MINFO specific waterlevel differences. + +2012-04-26 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java: + New parser for MINFO specific waterlevel differences. + + * src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceValue.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceColumn.java: + New importer classes used during the import process of MINFO specific + waterlevel differences. + +2012-04-26 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added a missing constraint to + 'waterlevel_difference' relation. Remove that constraint in + oracle-drop-minfo.sql. + +2012-04-25 Felix Wolfsteller + + * src/main/java/de/intevation/flys/model/WaterlevelDifferenceValue.java: + (setValue, setValues): Change setter name to allow hibernate to recognize + it. + +2012-04-24 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/WaterlevelDifferenceColumn.java, + src/main/java/de/intevation/flys/model/WaterlevelDifference.java, + src/main/java/de/intevation/flys/model/WaterlevelDifferenceValue.java: + New model classes for MINFO specific waterlevel differences. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes. + +2012-04-24 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Improved the schema to store MINFO + specific waterlevel differences. + +2012-04-24 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/WaterlevelValue.java: Renamed a + property ('qRange' -> 'qrange') because there have been problem during the + import. + + * src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java: + Filled the stub with code. + + * src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevel.java: Some + adaptions and missing methods which are required during the import. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Use the + correct directory to search for waterlevel files. + +2012-04-24 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql: Small type adaptions in the waterlevel_values + relation. + + * src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java: + First stub of a parser for MINFO specific waterlevel values. + + * src/main/java/de/intevation/flys/importer/Config.java: Added a new config + option to skip parsing MINFO specifc waterlevel_values: + + -Dflys.backend.importer.skip.waterlevels=True + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Added code + path to start parsing and storing MINFO specific waterlevel values. + +2012-04-20 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java, + src/main/java/de/intevation/flys/importer/ImportWaterlevel.java: New + importer classes used for MINFO specific waterlevel import. + +2012-04-20 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/WaterlevelQRange.java, + src/main/java/de/intevation/flys/model/WaterlevelValue.java, + src/main/java/de/intevation/flys/model/Waterlevel.java: New model + classes for MINFO specific waterlevel data. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes. + +2012-04-20 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added relations for waterlevels + specific to MINFO. Note: those waterlevel values are not stored in the + WINFO specific relations! + +2012-04-19 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + src/main/java/de/intevation/flys/importer/ImportSedimentYield.java, + src/main/java/de/intevation/flys/model/SedimentYield.java: Added a + column 'description' to the sediment_yield relation. + + * src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java: + New parser for sediment yield data. + + * src/main/java/de/intevation/flys/model/GrainFraction.java: Added constants + that represent the names of the grain fraction types. + + * src/main/java/de/intevation/flys/importer/ImportGrainFraction.java: New + constructor that takes a name only. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Improved the + process of parsing sediment yield files. + +2012-04-19 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added new config + option to skip parsing sediment yield data: + + -Dflys.backend.importer.skip.sediment.yield=true + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Prepared the + importer to parse sediment yield data. + + * src/main/java/de/intevation/flys/importer/ImportSedimentYield.java: + storeDependencies() now throws SQLExceptions and + ConstraintViolationExceptions. + +2012-04-19 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportGrainFraction.java, + src/main/java/de/intevation/flys/importer/ImportSedimentYieldValue.java, + src/main/java/de/intevation/flys/importer/ImportSedimentYield.java: New + importer classes for importing sediment yield data. + +2012-04-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/SedimentYield.java, + src/main/java/de/intevation/flys/model/SedimentYieldValue.java, + src/main/java/de/intevation/flys/model/GrainFraction.java: New model + classes for sediment yield data. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes. + +2012-04-18 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added missing river_id column to + sediment_yield relation. + +2012-04-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Floodmaps.java, + src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java, + src/main/java/de/intevation/flys/importer/ImportDischargeZone.java: + Removed superflous imports. + +2012-04-18 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added relations for storing sediment + yield values. + +2012-04-18 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: The discharge_zone relation has no + longer a reference to a named main value but stores a lower and upper + discharge as string. + + * src/main/java/de/intevation/flys/model/DischargeZone.java, + src/main/java/de/intevation/flys/importer/ImportDischargeZone.java: + Adapted the code to the changes in the db schema. + + * src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java: + This parser now reads the meta information properly. + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java: + Repaired broken HQL statement. + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java: + Log the number of flow velocity model values that have been written into + database. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java: + New parser for flow velocity measurements. + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java: + Fixed broken HQL statements. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Store flow + velocity measurements into database after parsing them. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes for flow velocity measurements. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java: + New temp classes used during the import process of flow velocity + measurements. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/FlowVelocityMeasurementValue.java, + src/main/java/de/intevation/flys/model/FlowVelocityMeasurement.java: New + model classes for storing flow velocity measurements. + +2012-04-17 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added new relations for MINFO specific + flow velocity measurements. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java: + New. Parser for model files of MINFO specific flow velocity data. + + * doc/schema/oracle-minfo.sql: Added a missing q column to + flow_velocity_model_values relation. + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java, + src/main/java/de/intevation/flys/model/FlowVelocityModelValue.java: + Added missing q column. + + * src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java: + Added setter methods for meta data and an addValue() for adding new + ImportFlowVelocityModelValues. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Use + FlowVelocityModelParser for parsing model data of flow velocity files. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportDischargeZone.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java, + src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java: + Temp classes used during the import process of flow velocity data. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Implemented + the method that stores flow velocity model data. + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Prepared for + parsing flow velocity files. + + * src/main/java/de/intevation/flys/importer/Config.java: Added a config + option to skip parsing flow velocity files: + + -Dflys.backend.importer.skip.flow.velocity=true + +2012-04-17 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/FlowVelocityModel.java, + src/main/java/de/intevation/flys/model/FlowVelocityModelValue.java, + src/main/java/de/intevation/flys/model/DischargeZone.java: New model + classes for MINFO specific database relations. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the new model classes. + +2012-04-16 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added new relations for MINFO specific + flow velocity values. + +2012-02-14 Sascha L. Teichmann + + * doc/schema/oracle-minfo.sql: Fixed column unit_id in table depths + to match type of column id in table units. + + * doc/schema/postgresql-minfo.sql: oracle-minfo.sql for a better DBMS. + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/MorphologicalWidth.java: Added + annotation for values. + + * src/main/java/de/intevation/flys/importer/ImportMorphWidthValue.java: + Removed debug output in getPeer() and storeDependencies(). + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java: + New parser for morphological widths files. + + * src/main/java/de/intevation/flys/importer/ImportMorphWidth.java: Throw + constraint violation exceptions. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Parse and + store morphological widths. + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added a config + option to skip parsing morphological widths: + + -Dflys.backend.importer.skip.morphological.width=true + +2012-04-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql: Added a description field to morphological + width values. + + * src/main/java/de/intevation/flys/model/MorphologicalWidthValue.java: + Added new instance variable for descriptions. + + * src/main/java/de/intevation/flys/importer/ImportMorphWidthValue.java, + src/main/java/de/intevation/flys/importer/ImportMorphWidth.java: New + temp classes used to store morphological width values during the import. + +2012-04-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Added new relations for MINFO specific + morphological width. + + * src/main/java/de/intevation/flys/model/MorphologicalWidth.java, + src/main/java/de/intevation/flys/model/MorphologicalWidthValue.java: New + model classes for morphological width. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model classes. + +2012-04-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql: Added a description field to table + sediment_density. + + * src/main/java/de/intevation/flys/model/SedimentDensityValue.java, + src/main/java/de/intevation/flys/model/SedimentDensity.java: Some + modifications based on the changes of the schema adaption in last commit. + + * src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java: + Override parse() of parent class to get the filename. + + * src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java, + src/main/java/de/intevation/flys/importer/ImportDepth.java, + src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java: + Implemented the methods storeDependencies() and getPeer() to save new + instances into database. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Save all + ImportSedimentDensity objects to database. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the new model classes. + +2012-04-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Modified the db schema specific to + MINFO; replaced some columns. + + * src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java: + Implemented the method stubs: parse meta data and data values. + + * src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java, + src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java: + Added and replaced some instance variables because the db schema has + changed. + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/LineParser.java: New. + An abstract parser that might be used to read a file and handle each + line contained in the file seperatly. + + * src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java: + New. Subclasses LineParser. It is able to parse MINFO specific sediment + density files. NOTE: currently just a stub. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Prepared to + read MINFO specific sediment density files. + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added a new + config option to skip parsing MINFO sediment density values: + + -Dflys.backend.importer.skip.sediment.density=true + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java, + src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java, + src/main/java/de/intevation/flys/importer/ImportDepth.java: New importer + classes used during MINFO sediment density import. + +2012-04-13 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Improved the MINFO schema to store + sediment density values specific to a river and depth. + + * src/main/java/de/intevation/flys/model/SedimentDensityValue.java, + src/main/java/de/intevation/flys/model/SedimentDensity.java, + src/main/java/de/intevation/flys/model/Depth.java: New model classes + used to store sediment density values specific to a river and depth. + +2012-04-13 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java: + New. An abstract super class for BedHeightSingleParser and + BedHeightEpochParser. It implements methods for parsing meta data. + Concrete subclasses need to implements the method for parsing data rows + only. + + * src/main/java/de/intevation/flys/importer/ImportBedHeight.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightValue.java: New. + Interfaces that define some major methods which enables the BedHeightParser + to parse both - single and epoch bed heights. + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java: + Moved the code for parsing meta data to BedHeightParser which is now the + parent class. + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java: + New. A further subclass of BedHeightParser for parsing MINFO bed heights + for epochs. + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightEpochValue.java: + Made them subclasses of ImportBedHeightValue. + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java: Made + them subclasses of ImportBedHeight. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Some + adjustments to store ImportBedHeight and ImportBedHeightValue instances + instead of concrete subclasses. + +2012-04-12 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql: Added a link to the river to bed_height_epoch + table. + + * src/main/java/de/intevation/flys/model/BedHeightEpochValue.java, + src/main/java/de/intevation/flys/model/BedHeightEpoch.java: New model + classes for MINFO bed height epochs. + + * src/main/java/de/intevation/flys/importer/Config.java: Splitted up the + config option to skip parsing bed heights. Now, we are able to skip single + and epoch bed heights using the following options: + + -Dflys.backend.importer.skip.bed.height.single=true (skip singles) + -Dflys.backend.importer.skip.bed.height.epoch=true (skip epochs) + + * src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightEpochValue.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: Implemented + the whole stuff to parse those data. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the new model classes. + +2012-04-12 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Schema adaptions specific to MINFO bed + heights. + + * src/main/java/de/intevation/flys/model/BedHeightSingleValue.java, + src/main/java/de/intevation/flys/model/BedHeightType.java, + src/main/java/de/intevation/flys/model/ElevationModel.java, + src/main/java/de/intevation/flys/model/LocationSystem.java, + src/main/java/de/intevation/flys/model/BedHeightSingle.java: New model + classes for MINFO bed heights. + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java: + Some logging adjustments and a little bugfix: add BedHeightSingle objects + after they were parsed; otherwise they are not saved to database. + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java, + src/main/java/de/intevation/flys/importer/ImportElevationModel.java, + src/main/java/de/intevation/flys/importer/ImportLocationSystem.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightType.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: Implemented + storeDependencies() and getPeer(). + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered model classes. + +2012-04-11 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java: + Finished work on parsing meta information and data specific to single bed + heights. + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java, + src/main/java/de/intevation/flys/importer/ImportElevationModel.java, + src/main/java/de/intevation/flys/importer/ImportLocationSystem.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightType.java: Some + new and modified temp storages used during MINFO import. + +2012-04-11 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: Some schema adaptions specific to bed + heights in MINFO. + +2012-04-11 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added new command + line option to skip parsing bed heights (german "Sohlhoehen"). + Set "-Dflys.backend.importer.skip.bed.height=true" to skip parsing this + file type. + + * src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java, + src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java: + Initial checkin of parsers for bed heights (single and epoch). + + * src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java, + src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java: Temp + storage for bed heights data used during the import. + + * src/main/java/de/intevation/flys/importer/Importer.java: Added an INFO + statement that signals the start of parsing rivers. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Collect and + trigger parsing of bed heights files (placed in 'Morphologie/Sohlhoehen'). + +2012-04-11 Ingo Weinzierl + + * doc/schema/oracle-minfo.sql, + doc/schema/oracle-drop-minfo.sql: MINFO specific DB schema and sql statements + to drop MINFO specific stuff. + +2012-03-29 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/Config.java: Added a config + option "flys.backend.importer.infogew.file" to set the path of an + INFO.gew file. + + * src/main/java/de/intevation/flys/importer/Importer.java: Read the path + to the INFO.gew from the new config option and try to parse it. + +2012-03-19 Ingo Weinzierl + + * doc/schema/oracle-spatial.sql: Set the type of 'lower' and 'upper' column + of relation 'dem' to NUMBER(19,5). + +2012-03-19 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Floodmaps.java: Set geometry type + to 'Geometry', because Oracle can save POLYGONS and MULTIPOLYGONS in the + same relation; Hibernate seems unable to load both types. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered missing Floodmaps. + +2012-03-16 Ingo Weinzierl + + * Tagged module as 'pre2.7-2012-03-16'. + +2012-03-16 Ingo Weinzierl + + * doc/schema/oracle-spatial.sql: Repaired broken oracle db schema for + relation 'floodmaps'. + +2012-03-08 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Floodmaps.java: New model class for + 'floodmaps'. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the Floodmaps model class. + +2012-03-07 Ingo Weinzierl + + * contrib/shpimporter/shpimporter.py, + contrib/shpimporter/utils.py, + contrib/shpimporter/uesg.py: A python based tool for importing + shapefiles into a database. This tool is based on python because it + makes use of GDAL OGR to read shapefiles and write features into + database. + +2012-03-07 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: Adapted the PostgreSQL schema for + floodmaps. + +2012-03-06 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql, + doc/schema/oracle-spatial.sql: Added new relations for existing + floodmaps (currently tested for PostgreSQL only!). + +2012-03-06 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Wst.java: Adapted method call of + Log4J logger 'warning()' -> 'warn()'. + +2012-03-02 Felix Wolfsteller + + Fix or workaround flys/issue632 . + + * src/main/java/de/intevation/flys/model/Wst.java: Avoid NPE when + trying to get min/max q values. + +2012-02-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/DischargeTable.java: + The list of DischargeTableValue is now sorted by Q. + +2012-02-09 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Gauge.java: Added a method + getMasterDischargeTable() to retrieve the discharge table with kind 0. + +2012-02-03 Felix Wolfsteller + + * src/main/java/de/intevation/flys/model/River.java + (getGaugeDatumsKMs,queryGaugeDatumsKMs): renamed to avoid hibernate + running into trouble finding db-mapping for type Map for + what looks like a 'getter' of GaugeDatumsKMs. + +2012-02-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java(getGaugeDatumsKMs): + New method to build a map of gauge stattion km to + the datums (PNP) of the gauge. Useful look if a km + is a gauge station. + +2012-01-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/FastAnnotations.java: + New. Fetches all informations of annotations in one go for + a river. Useful to speed up annotation handling. + +2012-01-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Gauge.java: Added a function that + returns a Gauge based on its official number. + +2012-01-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/FastCrossSectionLine.java: + New. Cacheable representation of the cross section line. + + * src/main/java/de/intevation/flys/model/CrossSectionLine.java: + Add a new isValid() method. + + * src/main/java/de/intevation/flys/model/CrossSection.java: + Added method getFastLines() to fetch the lines (FastCrossSectionLines) + directly with a single SQL statement and without expensive + intermediate representations. + +2012-01-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/CrossSection.java(getLines): + Added method to fetch the lines of a cross section in a given interval. + Useful to have chunked access to the lines. + +2012-01-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/CrossSectionLine.java + (fetchCrossSectionLinesPoints): Simplified and prevent reallocations. + +2012-01-10 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/StaFileParser.java: + Introduced boolean system property 'flys.backend.sta.parse.gauge.numbers' + default: false. If set the official number is parsed out of + the first line of the STA files. This leads to problems with the + data of the Elbe river. + + * src/main/java/de/intevation/flys/backend/SpatialInfo.java: Removed + superfluous import. + +2012-01-05 Sascha L. Teichmann + + * doc/schema/postgresql-spatial.sql: Fixed table hws. + +2012-01-05 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/RiverAxis.java: The method + getRiverAxis() now returns a list of RiverAxis objects. There is a + modeling problem (see comment in the header of the class) which should + be fixed! + + * src/main/java/de/intevation/flys/backend/SpatialInfo.java: Adapted the + code based on the modified signature in RiverAxis. + +2012-01-03 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Wst.java: Added a method + determineMinMaxQFree() that determines the min/max Qs at a given + kilometer. + +2012-01-02 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Remove 'NOT NULL' constraint from + gauges.range_id because there are gauges which don't have + a 'Gueltigkeitsbereich' + + To adjust existing PostgreSQL databases use: + + ALTER TABLE gauges ALTER COLUMN range_id DROP NOT NULL; + + * src/main/java/de/intevation/flys/model/River.java: Handle + null references to 'Gueltigkeitsbereiche'. + +2011-12-28 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Wst.java: Added a method + determineMinMaxQ(double double) to be able to determine the Q range of a + WST without having a Range object. + +2011-12-19 Sascha L. Teichmann : + + * src/main/java/de/intevation/flys/importer/parsers/StaFileParser.java: + Parse the official 'Pegelnummer' out of the STA files, too. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Adjusted import model. + + * src/main/java/de/intevation/flys/model/Gauge.java: Make the + official gauge number accessible via Hibernate. + + * doc/schema/postgresql.sql, doc/schema/oracle.sql: Added + an official_number to the gauges table. + +2011-11-30 Bjoern Schilberg : + + * doc/schema/oracle-spatial.sql: Adjust extent of germany to EPSG:31467 + (GK3) coordinates. + +2011-11-30 Bjoern Schilberg : + + * doc/schema/oracle-spatial.sql: Adjust extent to the extent of germany + and srs to 31467 in USER_SDO_GEOM_METADATA. + +2011-11-29 Bjoern Schilberg : + + * doc/schema/oracle_create_user.sql: Fixed notation of the table in the + alter statement. + +2011-11-18 Sascha L. Teichmann : + + Fixed flys/issue415 + + * doc/schema/oracle.sql: Increased precision of a and b in ranges. + +2011-11-10 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Building.java, + src/main/java/de/intevation/flys/model/Fixpoint.java: Added functions + that return a list of Buildings/Fixpoints for a given river. + +2011-11-10 Ingo Weinzierl + + * doc/schema/oracle-spatial.sql, + doc/schema/postgresql-spatial.sql: Adapted the "kind" field of "lines" + relation (Int -> Varchar). + + * doc/schema/oracle-spatial_idx.sql: Added missing spatial index for + "lines" relation. + + * src/main/java/de/intevation/flys/model/Line.java: Added a function that + returns all lines of a given river. + +2011-11-09 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Catchment.java: New. A model for + the 'catchment' relation. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the Catchment model. + +2011-11-09 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: Synced "hws" relation with oracle + schema. + + * src/main/java/de/intevation/flys/model/Hws.java: New. A model for the + "hws" relation. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the Hws model. + +2011-11-09 Ingo Weinzierl + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Added methods that return information about the database connection used + by a concrete SessionFactoryImpl. + +2011-11-09 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Floodplain.java: Changed the + geometry type from MultiPolygon to Polygon. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Added a function that returns the db driver of a given + SessionFactoryImpl instance. + +2011-11-01 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/RiverAxisKm.java: New. Model class + for 'river_axes_km' relation. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Added mapping for RiverAxisKm. + +2011-10-25 Bjoern Schilberg + + * doc/schema/oracle_create_user.sql: + Added explizit TABLESPACE definition for the user. + +2011-10-25 Bjoern Schilberg + + * doc/schema/oracle_create_user.sql: + Adjusted oracle_create_user.sql script. Added USER SQL snippet to change + tablespace to users. + +2011-10-05 Sascha L. Teichmann : + + * src/main/java/de/intevation/flys/utils/DateGuesser.java: + New. Date guesser from desktop FLYS. + + * src/main/java/de/intevation/flys/importer/parsers/WstParser.java: + Try to parse the name of a WST column as a date and store + the date into the database + + * src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Added code to store the date of the column in the database. + +2011-10-24 Bjoern Schilberg + + * doc/schema/postgresql-spatial.sql: + Adjusted geometry type for floodplain and hws in AddGeometryColumn. + +2011-10-19 Bjoern Schilberg + + * doc/schema/oracle.sql: + Added missing views (wst_value_table,wst_w_values,wst_q_values). + +2011-10-18 Bjoern Schilberg + + * doc/schema/oracle.sql: + Removed all CREATE OR REPLACE TRIGGER statements. + +2011-10-17 Bjoern Schilberg + + * doc/schema/oracle.sql: + Adjusted NUMBER format for units, positions and cross_section_points tables. + +2011-10-10 Bjoern Schilberg + + * doc/schema/oracle.sql: + Fix errors. + +2011-10-10 Bjoern Schilberg + + * doc/schema/oracle.sql: + Adjust oracle schema [I382]. + +2011-10-10 Felix Wolfsteller + + * src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportUnit.java: + Removed obsolete imports. + +2011-10-05 Sascha L. Teichmann : + + * ChangeLog: Added database update statements. + + To update existing databases: + + BEGIN; + CREATE SEQUENCE UNITS_ID_SEQ; + CREATE TABLE units ( + id int PRIMARY KEY NOT NULL, + name VARCHAR(32) NOT NULL UNIQUE + ); + ALTER TABLE rivers ADD COLUMN wst_unit_id int REFERENCES units(id); + INSERT INTO units (id, name) VALUES (nextval('UNITS_ID_SEQ'), 'NN + m'); + INSERT INTO units (id, name) VALUES (nextval('UNITS_ID_SEQ'), 'NHN + m'); + UPDATE rivers SET wst_unit_id = (SELECT id FROM units WHERE name = 'NHN + m') WHERE name = 'Elbe'; + UPDATE rivers SET wst_unit_id = (SELECT id FROM units WHERE name = 'NN + m') WHERE name <> 'Elbe'; + ALTER TABLE rivers ALTER COLUMN wst_unit_id SET NOT NULL; + COMMIT; + +2011-10-05 Ingo Weinzierl + + * contrib/dump-schema.sh: New. A small shell script that dumps the + database schema of a given database to SQL. + + * pom.xml: Added dependency for hibernate-spatial-oracle stuff. + +2011-10-04 Ingo Weinzierl + + * doc/schema/postgresql.sql: Removed unit column from wsts; added a + wst_unit_id column to rivers. We decided to support a single elevation + model for the whole river. + + * src/main/java/de/intevation/flys/model/River.java: Added a WstUnit + column. + + * src/main/java/de/intevation/flys/model/Wst.java: Removed the Unit + column. + + * src/main/java/de/intevation/flys/importer/ImportWst.java: Provide a + getUnit() method that allows querying the elevation unit for this wst. + + * src/main/java/de/intevation/flys/importer/ImportUnit.java: Removed + storeDependencies(). + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: Save the + Unit of the wst file or a default one into database before all other + dependencies as well as the river itself is saved to database. + +2011-10-04 Ingo Weinzierl + + * doc/schema/postgresql.sql: Added a "units" table. + + * src/main/java/de/intevation/flys/model/Unit.java: New. Model class that + represents a unit. + + * src/main/java/de/intevation/flys/importer/ImportUnit.java: New. Model + class that is used to import units. + + * src/main/java/de/intevation/flys/model/Wst.java: A Wst stores a Unit + which references "units" table now. + + * src/main/java/de/intevation/flys/importer/parsers/WstParser.java: Set + units which have already been parsed on Wsts. + + * src/main/java/de/intevation/flys/importer/ImportWst.java: Added setter + method for Units and call storeDependencies() for ImportUnits. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model class Unit. + +2011-10-04 Ingo Weinzierl + + flys/issue333 (W-INFO / Berechnung Wasserspiegellage, Zuordnung Bezugspegel) + + * src/main/java/de/intevation/flys/model/River.java: Modified + determination of gauge based on a km range. River.determineGauge(double, + double) will now return the gauge which matches the start km. + +2011-09-28 Felix Wolfsteller + + * src/main/java/de/intevation/flys/utils/StringUtil.java: + (wWrap): New method (extracted from WaterlevelSelectState). + +2011-09-28 Felix Wolfsteller + + * src/main/java/de/intevation/flys/utils/StringUtil.java: + (unbracket): New method (extracted from WaterlevelSelectState). + +2011-09-27 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/CrossSectionLine.java: + Moved some logic from cross section demo app to this model. + +2011-09-26 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/CrossSectionTrack.java: + Added new function that the nearest CrossSectionTrack of a river to a + given kilometer. + +2011-09-23 Bjoern Schilberg + + * doc/schema/postgresql-spatial.sql: + Added missing river_axes_km schema. + * doc/schema/oracle-spatial.sql: + Added missing dem and lines schema. + +2011-09-22 Bjoern Schilberg + + * doc/schema/postgresql-spatial.sql, doc/schema/oracle-spatial.sql: + Harmonized oracle and postgresql spatial schema. + +2011-09-22 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Harmonized Extent for Saar and Mosel. Some cleanups. + +2011-09-22 Ingo Weinzierl + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Added the possibility to enable JMX (/MBean) support for hibernate. By + default, this support is NOT enabled. To enable JMX support for + hibernate, set the system property "flys.backend.enablejmx=true". + +2011-09-20 Bjoern Schilberg + + * doc/schema/oracle_create_user.sql: Added right to create views. + +2011-09-20 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Generalized oracle spatial schema. + +2011-09-19 Ingo Weinzierl + + Tagged RELEASE 2.5 + + * Changes: Prepared changes for release. + +2011-09-16 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/DGM.java: Added function to query + a DGM by Id. + +2011-09-15 Bjoern Schilberg + + * pom.xml: Removed oracle dependency. + +2011-09-15 Bjoern Schilberg + + * doc/schema/oracle.sql: Added inital oracle schema. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial_idx.sql: Added inital oracle-spatial_idx.sql + script. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Deactivated spatial indexes. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle_create_user.sql: Added inital oracle_create_user.sql + script. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema floodplain. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema hws. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema cross_section_tracks. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema river_axes. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema fixpoints. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added schema buildings. + +2011-09-14 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Fixed table river_axes_km. + +2011-09-13 Bjoern Schilberg + + * doc/schema/oracle-spatial.sql: Added initial oracle schemas. + +2011-09-12 Bjoern Schilberg + + * doc/schema/postgresql-spatial.sql: Added initial schemas for + Hydrologie/Einzugsgebiete, Hydrologie/HW-Schutzanlagen, Hydrologie/Hydr. + Grenzen/Linien, BfG/hauptoeff_*.shp, BfG/MNQ-*.shp, + BfG/modellgrenze*.shp, BfG/uferlinie.shp, BfG/vorland_*.shp, + Hydrologie/Streckendaten, Hydrologie/UeSG/Berechnung, + Hydrologie/UeSG/Messung + +2011-09-02 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: Removed SERIALs from schema. + Auto-Increment is realized through SERIALs now. + + * src/main/java/de/intevation/flys/model/DGM.java: The table for dem has + been renamed to 'dem' (before 'dgm'). + +2011-09-01 Hans Plum + + * doc/schema/postgresql-spatial.sql: + Hint for unifying table names: dgm -> dem + +2011-09-01 Hans Plum + + * doc/schema/postgresql-spatial.sql: + Added mappings to existing data in file system (based on + river Saar); added TODOs for missing tables/mappings + +2011-08-31 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: New relation for floodplains (german + "Talaue"). + + * src/main/java/de/intevation/flys/model/Floodplain.java: New. Model class + that represents a floodplain. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the Floodplain mapping. + +2011-08-31 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: Added a relation for DGMs. Note, that + no data of the DGM is stored in this relation, but only the file path to + the DGM file. + + * src/main/java/de/intevation/flys/model/DGM.java: New. This class provides + information for a DGM (km range and file path). + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the DGM. + +2011-08-30 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/CrossSectionTrack.java: New + static function to retrieve all CrossSectionTracks of a specific river. + +2011-08-25 Ingo Weinzierl + + * src/main/java/de/intevation/flys/utils/FileTools.java: Moved to + artifacts-common module. + + * src/main/java/de/intevation/flys/importer/parsers/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/parsers/PRFParser.java, + src/main/java/de/intevation/flys/importer/parsers/HYKParser.java, + src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java, + src/main/java/de/intevation/flys/importer/parsers/InfoGewParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java: Adjusted + imports of FileTools. + +2011-08-25 Felix Wolfsteller + + * src/main/java/de/intevation/flys/model/Gauge.java (getMainValues) + (setMainValues): + New method and mapping to get/set MainValues of a Gauge. Essentially + developed by Sascha L. Teichmann. + +2011-08-22 Ingo Weinzierl + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Reverted the default db dialect to PostgreSQL - this has been changed to + PostGIS by accident. + Configure the dialect "org.hibernatespatial.postgis.PostgisDialect" to + use the PostGIS stuff. + +2011-08-22 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/RiverAxis.java: Added a function + that returns the RiverAxis for a given River. + + * src/main/java/de/intevation/flys/backend/SpatialInfo.java: Use the new + function of RiverAxis to retrieve the RiverAxis. + +2011-08-18 Ingo Weinzierl + + * doc/schema/postgresql-spatial.sql: The PostGIS database schema for + FLYS spatial data. + + * src/main/java/de/intevation/flys/model/CrossSectionTrack.java, + src/main/java/de/intevation/flys/model/RiverAxis.java, + src/main/java/de/intevation/flys/model/Line.java, + src/main/java/de/intevation/flys/model/Building.java, + src/main/java/de/intevation/flys/model/Fixpoint.java: Model classes that + represent FLYS spatial data. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered model classes. + + * pom.xml: Added dependencies to HibernateSpatial and PostGIS. + + * src/main/java/de/intevation/flys/backend/SpatialInfo.java, + contrib/spatial-info.sh: A small demo application that prints out some + information about spatial data of specific rivers. Modify the system + property -Dflys.backend.spatial.river to get information of a river of + your choice. + +2011-07-31 Sascha L. Teichmann + + Re-enabled Hibernate schema dumps. + + * src/main/java/de/intevation/flys/App.java: Removed old code + and use new SessionFactoryProvider infrastructure. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Added methods to create db configurations without opening them. + Useful for introspection only purposes. + +2011-07-31 Sascha L. Teichmann + + * pom.xml: Bumped Apache DBCP up to 1.4 to use the same version + as artifact database. + +2011-07-28 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Make use of the LRU cache from artifacts common. + +2011-07-18 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added missing foreign key contraint on hyks table. + To update existing databases: + + ALTER TABLE hyks ADD CONSTRAINT hyks_river_id_fkey FOREIGN KEY (river_id) REFERENCES rivers(id); + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/HYKParser.java: + Check if zone coordinates in HYKs are swapped and warn the user. + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/HYK.java + src/main/java/de/intevation/flys/importer/parsers/HYKParser.java, + src/main/java/de/intevation/flys/importer/ImportHYKFormation.java, + src/main/java/de/intevation/flys/importer/ImportHYKEntry.java, + src/main/java/de/intevation/flys/importer/ImportHYK.java: + Various small fixes and some extra logging. + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/Config.java: New. + Central singleton to configure the Importer. + Uses system properties by now: + + flys.backend.importer.dry.run: boolean + default false. true: don't write to database. + + flys.backend.importer.annotation.types: String + default unset. Filename of annotation type classifications. + + flys.backend.importer.skip.gauges: boolean + default: false. true: don't parse/store *.glt, *.sta files + + flys.backend.importer.skip.annotations: boolean + default: false. true: don't parse/store *.km files + + flys.backend.importer.skip.prfs: boolean + default: false. true: don't parse/store *.prf files + + flys.backend.importer.skip.hyks: boolean + default: false. true: don't parse/store *.hyk files + + flys.backend.importer.skip.wst: boolean + default: false. true: don't parse/store river wst files + + flys.backend.importer.skip.extra.wsts: boolean + default: false. true: don't parse/store extra *.zus, *.wst files + + flys.backend.importer.skip.fixations: boolean + default: false. true: don't parse/store fixation *.wst files + + flys.backend.importer.skip.official.lines: boolean + default: false. true: don't parse/store 'amtliche Linien' *.wst files + + flys.backend.importer.skip.flood.water: boolean + default: false. true: don't parse/store 'HW-Marken' *.wst files + + flys.backend.importer.skip.flood.protection: boolean + default: false. true: don't parse/store 'HW-Schutzanlagen' *.wst files + +2011-07-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/HYKEntry.java: Fixed OrderBy + clause. + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportHYKFormation.java, + src/main/java/de/intevation/flys/importer/ImportHYKFlowZone.java, + src/main/java/de/intevation/flys/importer/ImportHYKEntry.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportHYK.java: + Store HYK data structures to database. Needs testing. + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse the HYKs from the importer. TODO: Store them in database. + +2011-07-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/HYKParser.java: + Create data structures while parsing. + + * src/main/java/de/intevation/flys/importer/ImportHYKFormation.java, + src/main/java/de/intevation/flys/importer/ImportHYK.java: Added + getters/setters to ease model wiring. + +2011-07-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportHYKFormation.java, + src/main/java/de/intevation/flys/importer/ImportHYKFlowZone.java, + src/main/java/de/intevation/flys/importer/ImportHYKEntry.java, + src/main/java/de/intevation/flys/importer/ImportHYK.java: New. + Importer models for HYKs. + +2011-07-17 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Each entry in a HYK can have + an optional 'Peilungsjahr' (measure) not only the whole HYK. + To update existing databases: + BEGIN; + ALTER TABLE hyks DROP COLUMN measure; + ALTER TABLE hyk_entries ADD COLUMN measure TIMESTAMP; + COMMIT; + + * src/main/java/de/intevation/flys/model/HYKEntry.java, + src/main/java/de/intevation/flys/model/HYK.java: + Adjusted Hibernate models. + +2011-07-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/HYKParser.java: + Added callback mechanism and recursive file search like in the PRF parser. + All BfG-HYK files seem to parse correctly now. TODO: Build the data structures. + + * src/main/java/de/intevation/flys/importer/parsers/PRFParser.java: + Added x.canRead() before accepting files for parsing. + +2011-07-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/HYKParser.java: + Initial version of the HYK parser. Not ready, yet. + + * src/main/java/de/intevation/flys/importer/ImportHYKFlowZoneType.java: + Importer model for HYK flow zone types. + +2011-07-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Argh! Added distance_{vl|hf|vr} to + wrong table. + To update existing databases: + BEGIN; + ALTER TABLE hyk_entries DROP COLUMN distance_vl; + ALTER TABLE hyk_entries DROP COLUMN distance_hf; + ALTER TABLE hyk_entries DROP COLUMN distance_vr; + ALTER TABLE hyk_formations ADD COLUMN distance_vl NUMERIC NOT NULL; + ALTER TABLE hyk_formations ADD COLUMN distance_hf NUMERIC NOT NULL; + ALTER TABLE hyk_formations ADD COLUMN distance_vr NUMERIC NOT NULL; + COMMIT; + + * src/main/java/de/intevation/flys/model/HYKFormation.java, + src/main/java/de/intevation/flys/model/HYKEntry.java: + Adjusted Hibernate models. + +2011-07-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/utils/FileTools.java: Added method + walkTree() to traverse a directory tree. To be reused in HYK parser. + + * src/main/java/de/intevation/flys/importer/parsers/PRFParser.java: + Uses the FileTools.walkTree() method now to find all PRF file. + +2011-07-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added missing columns. + To update existing databases: + BEGIN; + ALTER TABLE hyks ADD COLUMN measure TIMESTAMP; + ALTER TABLE hyk_entries ADD COLUMN distance_vl NUMERIC NOT NULL; + ALTER TABLE hyk_entries ADD COLUMN distance_hf NUMERIC NOT NULL; + ALTER TABLE hyk_entries ADD COLUMN distance_vr NUMERIC NOT NULL; + COMMIT; + + * src/main/java/de/intevation/flys/model/HYKEntry.java, + src/main/java/de/intevation/flys/model/HYK.java: + Adjusted Hibernate models. + +2011-07-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/parsers/*.java: + New package. Moved the file parsers (*.gew, *.sta, *.at, *.glt, *.prf, *.km, *.wst) + into this package. + + * src/main/java/de/intevation/flys/importer/*.java: Adjusted the imports. + +2011-07-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/HYKFormation.java, + src/main/java/de/intevation/flys/model/HYKEntry.java, + src/main/java/de/intevation/flys/model/HYKFlowZone.java, + src/main/java/de/intevation/flys/model/HYKFlowZoneType.java, + src/main/java/de/intevation/flys/model/HYK.java: New. The hibernate models + for the HYK structures. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new models. + + * src/main/java/de/intevation/flys/model/CrossSection.java: Added + 'order by' annotation for fetching the cross section lines. + +2011-07-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added structures for HYKs "Hydraulische Kenngroessen" + To update existing databases: + + BEGIN; + CREATE SEQUENCE HYKS_ID_SEQ; + CREATE TABLE hyks ( + id int PRIMARY KEY NOT NULL, + river_id int NOT NULL, + description VARCHAR(256) NOT NULL + ); + + CREATE SEQUENCE HYK_ENTRIES_ID_SEQ; + CREATE TABLE hyk_entries ( + id int PRIMARY KEY NOT NULL, + hyk_id int NOT NULL REFERENCES hyks(id), + km NUMERIC NOT NULL, + UNIQUE (hyk_id, km) + ); + + CREATE SEQUENCE HYK_FORMATIONS_ID_SEQ; + CREATE TABLE hyk_formations ( + id int PRIMARY KEY NOT NULL, + formation_num int NOT NULL DEFAULT 0, + hyk_entry_id int NOT NULL REFERENCES hyk_entries(id), + top NUMERIC NOT NULL, + bottom NUMERIC NOT NULL, + UNIQUE (hyk_entry_id, formation_num) + ); + + CREATE SEQUENCE HYK_FLOW_ZONE_TYPES_ID_SEQ; + CREATE TABLE hyk_flow_zone_types ( + id int PRIMARY KEY NOT NULL, + name VARCHAR(50) NOT NULL UNIQUE, + description VARCHAR(256) + ); + + CREATE SEQUENCE HYK_FLOW_ZONES_ID_SEQ; + CREATE TABLE hyk_flow_zones ( + id int PRIMARY KEY NOT NULL, + formation_id int NOT NULL REFERENCES hyk_formations(id), + type_id int NOT NULL REFERENCES hyk_flow_zone_types(id), + a NUMERIC NOT NULL, + b NUMERIC NOT NULL, + CHECK (a <= b) + ); + COMMIT; + +2011-07-13 Sascha L. Teichmann + + * pom.xml: Bumped Hibernate up to 3.6.5. + +2011-07-11 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/utils/FileTools.java: Argh! + Forget to call the file hashing so only the file lengths were + compared. + +2011-07-11 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/utils/FileTools.java: + Added a class HashedFile to compare files by there length + and a message digest. Digest can be set with system property + "flys.backend.file.cmp.digest" and defaults to MD5. Useful to + detect file duplicates. + + * src/main/java/de/intevation/flys/importer/PRFParser.java: Added + method prfAccept(File) to callback to check if a found PRF file + should be parsed. Useful to prevent parsing file duplicates. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Use the HashedFile and the PRFParser.Callback to prevent + parsing of PRF duplicates. + +2011-07-08 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Misspelled sequence. + To update existing databases: + + DROP SEQUENCE CROSS_SECTION_LINES_SEQ; + CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ; + + * src/main/java/de/intevation/flys/importer/ImportCrossSection.java: + Added some logging because importing is slow. + + * src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java: + Prevent NPE if a cross section line from db has no points. + +2011-07-08 Sascha L. Teichmann + + Parse all PRFs in all subfolders of a river and store them + as cross sections into the database. Needs testing! + + * src/main/java/de/intevation/flys/importer/ImportCrossSection.java, + src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java: + New. Importer models for cross sections. + + * src/main/java/de/intevation/flys/importer/XY.java: + New. Made top level class from inner PRFParser.XY. + + * src/main/java/de/intevation/flys/importer/PRFParser.java: + Moved out XY class. Renamed callback. + + * src/main/java/de/intevation/flys/model/CrossSection.java, + src/main/java/de/intevation/flys/model/CrossSectionLine.java, + src/main/java/de/intevation/flys/model/CrossSectionPoint.java, + src/main/java/de/intevation/flys/importer/ImportTimeInterval.java: + Added convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse and store cross sections into database. + +2011-07-07 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Introduced a new table cross_section_line + holding the km of a set of points. + + * src/main/java/de/intevation/flys/model/CrossSectionLine.java: + New. Model for a single line of a "Querprofil". + + * src/main/java/de/intevation/flys/model/CrossSection.java: Removed + 'km' and 'points' they are part of the line now. + + * src/main/java/de/intevation/flys/model/CrossSectionPoint.java: + They reference to the containing line now. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered new model. + + To update existing databases: + BEGIN; + DROP SEQUENCE CROSS_SECTIONS_ID_SEQ; + DROP SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; + DROP TABLE cross_section_points; + DROP TABLE cross_sections; + CREATE SEQUENCE CROSS_SECTIONS_ID_SEQ; + CREATE TABLE cross_sections ( + id int PRIMARY KEY NOT NULL, + river_id int NOT NULL REFERENCES rivers(id), + time_interval_id int REFERENCES time_intervals(id), + description VARCHAR(256) + ); + CREATE SEQUENCE CROSS_SECTION_LINES_SEQ; + CREATE TABLE cross_section_lines ( + id int PRIMARY KEY NOT NULL, + km NUMERIC NOT NULL, + cross_section_id int NOT NULL REFERENCES cross_sections(id), + UNIQUE (km, cross_section_id) + ); + CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; + CREATE TABLE cross_section_points ( + id int PRIMARY KEY NOT NULL, + cross_section_line_id int NOT NULL REFERENCES cross_section_lines(id), + col_pos int NOT NULL, + x NUMERIC NOT NULL, + y NUMERIC NOT NULL, + UNIQUE (cross_section_line_id, col_pos) + ); + COMMIT; + +2011-07-07 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Dropped constraint that enforces the + uniqueness of km and river. This is violated because there are + more than one sounding in different year at the same km of a river. + Added column 'description' to the cross section table to make it + human readable. + + To update existing databases: + + ALTER TABLE cross_sections DROP CONSTRAINT cross_sections_km_key; + ALTER TABLE cross_sections ADD COLUMN description VARCHAR(256); + + * src/main/java/de/intevation/flys/model/CrossSection.java: + Added the description column to the Hibernate model. + +2011-07-07 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Dropped constraint that enforces the + uniqueness of x in a "Querprofil-Spur". There are vertical lines + in the soundings so this constraint is violated. + + To update existing databases: + + ALTER TABLE cross_section_points DROP CONSTRAINT cross_section_points_cross_section_id_key2; + +2011-07-07 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PRFParser.java: + Added a callback to be called from parsePRFs() if + a PRF was parsed successfully. Useful to scan whole + sub directories for PRF files. + +2011-07-07 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PRFParser.java: + Extract the year of sounding from file names. If not found + from the name of th containing directory. Description is made + of file name and parent directory file name. + +2011-07-07 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PRFParser.java: + Extracted the data. All BfG PRFs are parsed correctly, now. + +2011-07-07 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PRFParser.java: + Extract km from lines. TODO: extract data. + +2011-07-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PRFParser.java: New. + Parser for PRF files. TODO extra data and station from data lines. + +2011-07-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Point3d.java: Deleted. + Not needed (braindead). + + * src/main/java/de/intevation/flys/model/CrossSectionPoint.java: + Directly store the x/y values now. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Removed registration of Point3d. + + To update existing databases: + + BEGIN; + ALTER TABLE cross_section_points DROP COLUMN point3d_id; + DROP SEQUENCE POINTS3D_ID_SEQ; + DROP TABLE points3d; + ALTER TABLE cross_section_points ADD COLUMN x NUMERIC NOT NULL; + ALTER TABLE cross_section_points ADD COLUMN y NUMERIC NOT NULL; + ALTER TABLE cross_section_points ADD CONSTRAINT + cross_section_points_cross_section_id_key2 UNIQUE (cross_section_id, x); + COMMIT; + +2011-07-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/CrossSection.java, + src/main/java/de/intevation/flys/model/CrossSectionPoint.java: + New. Hibernate models for cross-sections and their forming points. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered the new models. + +2011-07-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Point3d.java: New. point3d model + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Registered point3d model. + +2011-07-06 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Add relations for cross sections. + To update existing databases: + BEGIN; + + CREATE SEQUENCE CROSS_SECTIONS_ID_SEQ; + CREATE TABLE cross_sections ( + id int PRIMARY KEY NOT NULL, + km NUMERIC NOT NULL, + river_id int NOT NULL REFERENCES rivers(id), + time_interval_id int REFERENCES time_intervals(id), + UNIQUE (km, river_id) + ); + + CREATE SEQUENCE POINTS3D_ID_SEQ; + CREATE TABLE points3d ( + id int PRIMARY KEY NOT NULL, + x NUMERIC NOT NULL, + y NUMERIC NOT NULL, + z NUMERIC NOT NULL + ); + + CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; + CREATE TABLE cross_section_points ( + id int PRIMARY KEY NOT NULL, + cross_section_id int NOT NULL REFERENCES cross_sections(id), + point3d_id int NOT NULL REFERENCES points3d(id), + col_pos int NOT NULL, + UNIQUE (cross_section_id, point3d_id, col_pos), + UNIQUE (cross_section_id, col_pos) + ); + + COMMIT; + +2011-06-28 Ingo Weinzierl + + Tagged RELEASE 2.4 + +2011-06-27 Ingo Weinzierl + + * Changes: Prepared changes for the upcoming release. + +2011-06-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java, + src/main/java/de/intevation/flys/importer/AnnotationClassifier.java, + src/main/java/de/intevation/flys/importer/AtFileParser.java, + src/main/java/de/intevation/flys/importer/ValueKey.java, + src/main/java/de/intevation/flys/importer/WstParser.java: + Removed trailing whitespace. + +2011-06-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AnnotationClassifier.java: + Removed superfluous imports. + +2011-06-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: + Added a method maxOverlap to determine the gauge which has + the max common length to a given interval. This is for + numerical stability in slightly overlapping gauge ranges. + +2011-06-26 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: When + looking up a gauge by km containment use precision of 1e-6. + +2011-06-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: + Added method to find gauge by its name. + +2011-06-19 Sascha L. Teichmann + + * doc/annotation-types.xml: Fixed some rules. + + * src/main/java/de/intevation/flys/importer/Importer.java, + src/main/java/de/intevation/flys/importer/InfoGewParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Call the right constructors now. + + * src/main/java/de/intevation/flys/importer/ImportAnnotationType.java: + Added getter/setter for name property. + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java: + Print duplicated at WARN level not as DEBUG. + + * src/main/java/de/intevation/flys/importer/AnnotationClassifier.java: + Fixed XPath expression to build the internal lookup structures + correctly. + +2011-06-19 Sascha L. Teichmann + + Added classification of annotation types. Needs testing! + + * doc/annotation-types.xml: New. Rules to classify the different + types of annotations. The classification works like this: + + There are unique types like 'Bruecke', 'Pegel' and so on. + They are defined in the /annotation/type section and + identified by their name. One of the types can be set + as the default type if no rule applies. + + In the /annotation/pattern section are two types of pattern. + + 1 - file pattern: If a KM file is opened its filename is + matched against the regular expressions of these + patterns. If a match is found the corresponding type + is used as the default type in the open file. + If no match is found the global default type is used + as the default type. + + 2 - line patterns: For each line of an open KM file these + patterns are applied to find a match. If a match is + found the corresponding type is used as the type of + the annotation. If no match is found the default + file default is assumed to be the right type. For + the file default see 1. + + * src/main/java/de/intevation/flys/importer/Importer.java: + To activate the annotation type classification set + the system property + + 'flys.backend.importer.annotation.types' + + to the path of a XML looking like the annotation-types.xml + file. If the system property is not set no classification + is done. + + * src/main/java/de/intevation/flys/importer/AnnotationClassifier.java: + New. Implements the classification. + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java, + src/main/java/de/intevation/flys/importer/InfoGewParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Looped through the annotation type classification. + +2011-06-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: + Added method to find gauge by a position lying in its range. + +2011-06-14 Sascha L. Teichmann + + First part of flys/issue18 + + * doc/schema/postgresql.sql: Add new table 'annotation_types'. + To update existing databases: + BEGIN; + CREATE SEQUENCE ANNOTATION_TYPES_ID_SEQ; + CREATE TABLE annotation_types ( + id int PRIMARY KEY NOT NULL, + name VARCHAR(256) NOT NULL UNIQUE + ); + ALTER TABLE annotations ADD COLUMN type_id int REFERENCES annotation_types(id); + COMMIT; + + * doc/schema/postgresql-cleanup.sql: Removed. Hopeless out-dated. + + * src/main/java/de/intevation/flys/model/AnnotationType.java: + New. Hibernate model to access the type. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Register the new backend type. + + * src/main/java/de/intevation/flys/model/Annotation.java: + References the annotation type. + + * src/main/java/de/intevation/flys/importer/ImportAnnotationType.java: + New. Model to help import the annotation type. + + * src/main/java/de/intevation/flys/importer/ImportAnnotation.java: + Uses the import type. + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java: + Set the annotation type to 'null'. TODO: Do the classification! + +2011-06-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Fix for flys/issue110. start index was shifted by one. + +2011-06-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportAnnotation.java: + Forgot to store reference to edge. + +2011-06-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Register backend model. + + * src/main/java/de/intevation/flys/importer/ImportEdge.java: New. Model + for importing the edges. + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java: + Parses the edges of an annotation, too. + +2011-06-14 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added table edges to model 'Kanten' of an annotation. + To update existing databases: + BEGIN; + CREATE SEQUENCE EDGES_ID_SEQ; + CREATE TABLE edges ( + id int PRIMARY KEY NOT NULL, + top NUMERIC, + bottom NUMERIC); + ALTER TABLE annotations ADD COLUMN edge_id int REFERENCES edges(id); + COMMIT; + + * src/main/java/de/intevation/flys/model/Edge.java: New. A 'Kanten'-Model. + * src/main/java/de/intevation/flys/model/Annotation.java: References the + edges. + +2011-06-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: + Added method to find gauge only by station position. + +2011-05-24 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/River.java: + Make search for gauges independent of from/to order. + +2011-05-24 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added a new view to select qs of a WST. + To update existing databases: + + CREATE VIEW wst_q_values AS + SELECT wc.position AS column_pos, + wqr.q AS q, + r.a AS a, + r.b AS b, + wc.wst_id AS wst_id + FROM wst_column_q_ranges wcqr + JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id + JOIN ranges r ON wqr.range_id = r.id + JOIN wst_columns wc ON wcqr.wst_column_id = wc.id + ORDER BY wc.position, wcqr.wst_column_id, r.a; + +2011-05-24 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added a new view to select ws of a WST. + To update existing databases: + + CREATE VIEW wst_w_values AS + SELECT wcv."position" AS km, + wcv.w AS w, + wc."position" AS column_pos, + w.id AS wst_id + FROM wst_column_values wcv + JOIN wst_columns wc ON wcv.wst_column_id = wc.id + JOIN wsts w ON wc.wst_id = w.id + ORDER BY wcv."position", wc."position"; + +2011-05-23 Sascha L. Teichmann + + flys/issue76 + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Close gaps between q ranges. + +2011-05-20 Ingo Weinzierl + + Tagged RELEASE 2.3.1 + +2011-05-13 Ingo Weinzierl + + Tagged RELEASE 2.3 + +2011-05-13 Ingo Weinzierl + + * Changes: Changes for release 2.3 - see Changes file to get to know about + the version numbers of this software. + +2011-05-10 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added a column which tells + if a river counts its km up or downwards. + To update existing databases: + + ALTER TABLE rivers ADD COLUMN km_up BOOLEAN NOT NULL DEFAULT true; + + * src/main/java/de/intevation/flys/model/River.java: + Adjust Hibernate mapping of new column. + +2011-05-10 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Fixed flys/issue11 and flys51. + +2011-05-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ValueKey.java: + Add some unsharp comparison (eps = 1e-6) to avoid + numerical problems. + + * src/main/java/de/intevation/flys/importer/IdValueKey.java: + Removed. Not need any longer. + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Use unsharp lookup. + + * src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Flush more often. Hopefully this reduces hibernate sync + problems?! + +2011-05-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Fixed silly bug. Set flush mode back to auto because + manual flushing causes some undetermined problems. + +2011-05-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Do not load _all_ values from discharge tables and + wst columns. This is extremly slow and will lead + to OOM if more rivers are imported. Now only the + last 20 columns und discharge tables are cached. + + * src/main/java/de/intevation/flys/importer/ValueKey.java: + New. Key for caching discharge table values and wst + column values. + + * src/main/java/de/intevation/flys/importer/IdValueKey.java: + Fixed bug in equals(). + + * src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Removed too eloquent debug output. + +2011-05-09 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/IdValueKey.java: + Use BigDecimals as representation for the numeric components + which prevents running into unique constraint problems + caused by imprecision. + + * src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImporterSession.java: + Ranges are now cached globally, too. + + * src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Improved logging. + + * src/main/java/de/intevation/flys/importer/ImportDischargeTableValue.java: + Removed superfluous imports. + +2011-05-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/StaFileParser.java: + Only accept main value types 'Q', 'W', 'D' and 'T' by default. + '-' is not handled any more because it causes too much constraint + problems. You can overwrite the imported type with the + system property flys.backend.main.value.types" (default "QWTD") + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Set session flush mode to manual. Hopefully this improves the + performance a bit. + + * src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java, + src/main/java/de/intevation/flys/importer/ImportWstColumn.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + Improved logging. + +2011-05-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstColumnValueKey.java: Deleted + * src/main/java/de/intevation/flys/importer/IdValueKey.java: Reinserted + here in a more generalized form. + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + Cache the discharge table value, too. + + * src/main/java/de/intevation/flys/importer/ImportDischargeTableValue.java: + Use the global cache. + +2011-05-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImporterSession.java: + New. Centralized caching in the thread local context. Importing + the Elbe leads to OOM because the column values of the + WST files where loaded separately for every file. + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/Importer.java, + src/main/java/de/intevation/flys/importer/ImportAnnotation.java, + src/main/java/de/intevation/flys/importer/ImportWstQRange.java, + src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportMainValue.java, + src/main/java/de/intevation/flys/importer/ImportMainValueType.java, + src/main/java/de/intevation/flys/importer/ImportNamedMainValue.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java, + src/main/java/de/intevation/flys/importer/ImportWstColumnValue.java, + src/main/java/de/intevation/flys/importer/ImportWstColumnQRange.java, + src/main/java/de/intevation/flys/importer/ImportWstColumn.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImportDischargeTableValue.java, + src/main/java/de/intevation/flys/importer/ImportDischargeTable.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java, + src/main/java/de/intevation/flys/importer/ImportTimeInterval.java: + Adjusted to use the new global context. + +2011-05-08 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Dropped constraint which + forces discharge tables to have a unique time interval + for a given gauge and kind. + + There are AT files (historical Mosel/Perl/Perl/1967-1981.at + and Mosel/Perl/1967-1981-1.at) which violate this + constraint. Its a technical question to the customer + how to handle these cases. + + To adjust existing databases: + + ALTER TABLE discharge_tables DROP CONSTRAINT discharge_tables_gauge_id_key; + +2011-05-08 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + There are wst files where column names are not unique. + Make them unique by appending (1), (2) and so on. + +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Import the "HW-Schutzanlagen", too. + +2011-05-05 Sascha L. Teichmann + + Make import of historical discharge tables work. + + * doc/schema/postgresql.sql: Added forgotten column 'description'. + + !!! You have to drop your database !!! + + * src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + src/main/java/de/intevation/flys/model/DischargeTable.java: + Add the forgotten description property. + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Fixed problems with date recognition. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Prefix the description of the historical discharge tables + with "Histor.Abflusstafeln". + + * src/main/java/de/intevation/flys/importer/ImportTimeInterval.java: + Fixed silly programming error. + +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Inject 'kind' attribute. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Traverse the "Histor.Abflusstafeln" for the historical + discharge tables. too. TODO: Store them in the database. + + * src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + Added convinience constructor to set the kind of the + discharge table. + +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Prefix "Zusätzliche Längsschnitte" with "Zus.Längsschnitte" + in description. + +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Import 'Hochwasser-Marken', too. + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Removed superfluous import. + +2011-05-05 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Ignore lines that contain km positions which were found + before in the same file. + +2011-05-05 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/River.java: Added a method that + returns all gauges of the river intersected by a given start and end + point. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportTimeInterval.java: + Forgot to fetch peer from result set. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportTimeInterval.java: + New. Importer model help fetching the database peer. + + * src/main/java/de/intevation/flys/model/TimeInterval.java: + Add convinience constructor with start and stop time. + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Attach a time interval to a discharge table if we find one. + + * src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + Store the reference to the importer model of the + time interval of the discharge table. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: + Try to extract time ranges from at files. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse and store "amtliche Linien" wst files. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse and store fixation wst files as well. + +2011-05-03 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse the "zusaetzliche Laengsschnitte", too. + + * src/main/java/de/intevation/flys/importer/ImportWst.java: + Add getter/setter for column 'kind'. + +2011-05-02 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Fixed flys/issue19: Do not take km column in wst file as a water level. + +2011-05-02 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Gauge.java: Introduced a 'scale' + that is used to adjust the range of min/max W values. + +2011-05-01 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Removed superfluous import. + +2011-04-20 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/WstColumnValueKey.java: + New. This class is used as distinct key of a WstColumnValue - e.g. as + key in a map. + + * src/main/java/de/intevation/flys/importer/ImportWst.java: A + WstColumnValue cache is build up while initialization. This cache + contains all WstColumnValues that exist in the database. + + * src/main/java/de/intevation/flys/importer/ImportWstColumn.java: New + constructor that takes the WstColumnValues cache. It is used to + initialize new ImportWstColumnValue objects. + + * src/main/java/de/intevation/flys/importer/ImportWstColumnValue.java: + Speedup: A ImportWstColumnValue has a WstColumnValues cache that + contains all WstColumnValues existing in the database. This makes it + unnecessary to call an sql statement for each WstColumnValue to + determine its existence in the database. + +2011-04-18 Sascha L. Teichmann + + * doc/schema/postgresql.sql, doc/schema/postgresql-cleanup.sql: + Added a view 'wst_value_table' which aggregates the data + to build w/q value tables. + + To update existing databases: + + BEGIN; + CREATE VIEW wst_value_table AS + SELECT wcv.position AS position, + w, + (SELECT q + FROM wst_column_q_ranges wcqr + JOIN wst_q_ranges wqr + ON wcqr.wst_q_range_id = wqr.id + JOIN ranges r + ON r.id = wqr.range_id + WHERE wcqr.wst_column_id = wc.id + AND wcv.position BETWEEN r.a AND r.b) AS q, + wc.position AS column_pos, + w.id AS wst_id + FROM wst_column_values wcv + JOIN wst_columns wc + ON wcv.wst_column_id = wc.id + JOIN wsts w + ON wc.wst_id = w.id + ORDER BY wcv.position ASC, + wc.position DESC; + COMMIT; + +2011-04-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Wst.java: + Add forgotten one to many relation Wst -> WstColumn. + +2011-04-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/WstParser.java: + Import of q ranges of wst files was totally broken. :-/ + You have to reimport all your data. + +2011-04-18 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + Forgot kind parameter in peer fetching query. + +2011-04-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/River.java:: + Added a new method to determine the gauge based on a given start and end + point of the river. + +2011-04-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added 'position' column to wst_columns + to allow order them by there column position in the original + wst file. + + Update existing database with: + + BEGIN; + ALTER TABLE wst_columns ADD COLUMN position int; + UPDATE wst_columns w SET + position = id - (SELECT min(id) FROM wst_columns WHERE wst_id = w.wst_id); + ALTER TABLE wst_columns ADD CONSTRAINT wst_columns_wst_id_position_key + UNIQUE (wst_id, position); + COMMIT; + + * src/main/java/de/intevation/flys/model/Wst.java, + src/main/java/de/intevation/flys/model/WstColumn.java: + Adjusted models. + + * src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Adjusted importer. + +2011-04-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Forget ',' in schema. + +2011-04-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Wst.java (determineMinMaxQ): + Fixed index problem when an empty list is returned. + +2011-04-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/Wst.java: A Wst is now able to + return its min and max Q values. + + * src/main/java/de/intevation/flys/model/Gauge.java: A Gauge is now able + to return its min and max W values. + +2011-04-15 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Added new column 'kind' in + discharge tables and wst to distinguish between different + kinds like 'Haupt-WST', 'zusaetzliche Laengsschnitte', + 'amtliche Daten' and so on. + + Update existing databases with: + BEGIN; + ALTER TABLE discharge_tables ADD COLUMN kind int NOT NULL DEFAULT 0; + ALTER TABLE wsts ADD COLUMN kind int NOT NULL DEFAULT 0; + COMMIT; + + * src/main/java/de/intevation/flys/model/DischargeTable.java + src/main/java/de/intevation/flys/model/Wst.java, + src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: + Adjusted the models. + +2011-04-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/backend/SessionHolder.java: Moved to + this module from flys-artifacts. This is necessary to get access to the + current session in this module as well. + +2011-04-14 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/River.java: Added a method that + returns the min and max distance of a river. + +2011-04-03 Sascha L. Teichmann + + * src/**/*.java: Removed trailing whitespace. + +2011-03-30 Ingo Weinzierl + + Tagged RELEASE 0.1 + +2011-03-28 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Range.java: + Forgot to save the last change before commit. + +2011-03-28 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Range.java: + Added methods to find out if two ranges intersects. + +2011-03-24 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java: + Added an one to many relation to the discharge tables of a gauge. + +2011-03-22 Sascha L. Teichmann + + Finished import of WSTs. + + TODO 1: Speed it up! It takes on a high end machine over 7(!) + minutes only for the data of the Saar. + TODO 2: Double precision floating point representations produced + by the the parsers leed to unique constraint violations + in the backend on a second run. So the import is currently + only working on freshly initialized data bases. + More consequent working with BigDecimal and some + rounding may be of help here. + + * src/main/java/de/intevation/flys/model/WstColumnValue.java: + Added convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportWstColumnValue.java: + Added getPeer() method. + + * src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Add a list of the ImportWstColumnValues produced by the WST parser. + + * src/main/java/de/intevation/flys/importer/WstParser.java: Add + the (km, w) values to the ImportWstColumns. + +2011-03-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Build models for wsts, wst columns and q ranges and + store them in the backend. TODO: store the w values. + + * src/main/java/de/intevation/flys/model/WstQRange.java + src/main/java/de/intevation/flys/model/Wst.java, + src/main/java/de/intevation/flys/model/Range.java, + src/main/java/de/intevation/flys/model/WstColumnQRange.java, + src/main/java/de/intevation/flys/model/WstColumn.java: + Added convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportWstQRange.java, + src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportWstColumnQRange.java, + src/main/java/de/intevation/flys/importer/ImportWstColumn.java, + src/main/java/de/intevation/flys/importer/ImportRange.java: + Added getPeer() methods. + +2011-03-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + The unit extraction in the WST parser of desktop FLYS + is broken! Add a hack here to repair this for our + importer. Desktop FLYS needs a fix, too! + +2011-03-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java: + Ported some stuff ver from WSTSource.java of desktop flys to + parse WST files. TODO: create instances of the import models. + + * src/main/java/de/intevation/flys/utils/StringUtil.java: + Copied from desktop flys. Used for some string operations + in WST parser. + + * src/main/java/de/intevation/flys/importer/Importer.java: + Added system property 'flys.backend.importer.dry.run'. + Set to true only the parsing is done and no writing + to the backend. Default: false. + + * src/main/java/de/intevation/flys/App.java, + src/main/java/de/intevation/flys/model/MainValueType.java: + Removed needless imports. + +2011-03-22 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/DischargeTableValue.java, + src/main/java/de/intevation/flys/model/DischargeTable.java: Added new + constructors. + + * src/main/java/de/intevation/flys/importer/AtFileParser.java: New. This + parser is used to '*.at' files. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: Added code to + import discharge tables. + + * src/main/java/de/intevation/flys/importer/ImportDischargeTableValue.java, + src/main/java/de/intevation/flys/importer/ImportDischargeTable.java: New. + Helper models for import discharge tables. + +2011-03-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/WstParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java: + Added stub for WST parser. + +2011-03-22 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportWstQRange.java, + src/main/java/de/intevation/flys/importer/ImportWst.java, + src/main/java/de/intevation/flys/importer/ImportWstColumnValue.java, + src/main/java/de/intevation/flys/importer/ImportWstColumnQRange.java, + src/main/java/de/intevation/flys/importer/ImportWstColumn.java: + Added importer helper model stubs for WST imports. + +2011-03-21 Sascha L. Teichmann + + Second part of parsing/storing main values. Should be finished now. + + * src/main/java/de/intevation/flys/importer/ImportNamedMainValue.java, + src/main/java/de/intevation/flys/importer/ImportMainValue.java: + New. Helper models for import main values, + + * src/main/java/de/intevation/flys/model/MainValue.java, + src/main/java/de/intevation/flys/model/NamedMainValue.java: + Added convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Write main values to backend, too. + + * src/main/java/de/intevation/flys/importer/StaFileParser.java: + Build importer models for main values. + + * src/main/java/de/intevation/flys/importer/ImportMainValueType.java: + Data was called 'value'. Now it is 'name' to fit the + schema. + +2011-03-21 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Fixed wrong unique constraint. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Added some logging when storing gauges. + +2011-03-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java: + Add forgotten column river_id. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Small HQL fix. + +2011-03-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Gauge.java: + Added convinience contructor. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Fixed getPeer() method. + + * src/main/java/de/intevation/flys/importer/StaFileParser.java: + Fixed parsing of STA files. + +2011-03-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java: + Propagate river into storing of gauges. + +2011-03-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/Importer.java: + Added code to store rivers not only annotations. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Added stub code to write gauges. + +2011-03-17 Sascha L. Teichmann + + First part of parsing main values. + + * src/main/java/de/intevation/flys/App.java: Commented out + creation of dummy rivers. + + * src/main/java/de/intevation/flys/model/NamedMainValues.java: + Moved to NamedMainValue. + + * src/main/java/de/intevation/flys/model/NamedMainValue.java: + New. Formerly NamedMainValues. + + * src/main/java/de/intevation/flys/model/MainValue.java: + New. Forgotten part of the model. + + * src/main/java/de/intevation/flys/model/MainValueType.java: + Data is String not BigDecimal + + * src/main/java/de/intevation/flys/model/Range.java: Removed + contructor with double arguments. Using BigDecimal now. + + * src/main/java/de/intevation/flys/importer/PegelGltParser.java: + Propagate BigDecimal usage. + + * src/main/java/de/intevation/flys/importer/Importer.java: + Removed needless import. Added TODO + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Parse the dependencies of the gauges, too. + + * src/main/java/de/intevation/flys/importer/StaFileParser.java: + New. Parser for STA files. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + Call STA file parser. + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java, + src/main/java/de/intevation/flys/importer/ImportRange.java: + Uses BigDecimal now. + + * src/main/java/de/intevation/flys/importer/ImportAttribute.java: + Fixed wrong type cast in equals. + + * src/main/java/de/intevation/flys/importer/ImportMainValueType.java: + New. Helper model for importing main value types. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Register forgotten MainValue model. + +2011-03-17 Sascha L. Teichmann + + Store annotations in backend. + + * src/main/java/de/intevation/flys/model/Annotation.java: + New convinience constructor. + + * src/main/java/de/intevation/flys/model/River.java: + Added toString() method. + + * src/main/java/de/intevation/flys/model/Range.java: + Fixed nasty mistake in @OneToOne annotatation. + New convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportPosition.java + src/main/java/de/intevation/flys/importer/ImportAnnotation.java, + src/main/java/de/intevation/flys/importer/ImportRange.java + src/main/java/de/intevation/flys/importer/ImportAttribute.java: + Make storing to backend work. It's a bit too slow. :-/ + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Fetch peer from backend. Added method to store annotations. + * src/main/java/de/intevation/flys/importer/Importer.java: + Stored annotations into backend. More eloquent SQL exception + handling. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Attribute.java, + src/main/java/de/intevation/flys/model/Position.java: + Added convinience constructors. + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java: + Bound them to there backend peers. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/AnnotationsParser.java: + New. Added parser to read *.KM files. + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/ImportRiver.java, + src/main/java/de/intevation/flys/importer/ImportAnnotation.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/InfoGewParser.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java: + Adjusted to load the annotations from *.KM files. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/ImportPosition.java, + src/main/java/de/intevation/flys/importer/ImportRange.java, + src/main/java/de/intevation/flys/importer/ImportAttribute.java, + src/main/java/de/intevation/flys/importer/ImportAnnotation.java: + New helper models for import. + + * src/main/java/de/intevation/flys/importer/PegelGltParser.java, + src/main/java/de/intevation/flys/importer/ImportGauge.java: + Use new models. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/PegelGltParser.java: + New. Parser for PEGEL.GLT files. + + * src/main/java/de/intevation/flys/importer/ImportGauge.java: + New. Import model for gauges. + + * src/main/java/de/intevation/flys/utils/DBCPConnectionProvider.java: + Removed needless imports. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Added method to parse the gauges. + + * src/main/java/de/intevation/flys/importer/InfoGewParser.java: + Trigger pegel glt file parsing. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/Importer.java: + Used thread local pattern to make sharing of session easier. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/Importer.java: + Fixed error in HQL statement. + +2011-03-17 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/utils/DBCPConnectionProvider.java: + Commented out a debug block because it leaks the db password. + +2011-03-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/importer/InfoGewParser.java: + Expose imported rivers. + + * src/main/java/de/intevation/flys/importer/InfoGewParser.java: + Store imported rivers into database. Needs testing! + +2011-03-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Default connection parameters are now overwritable with + system properties (defaults in brackets): + - user name: flys.backend.user (flys) + - user password: flys.backend.password (flys) + - db dialect: flys.backend.dialect (org.hibernate.dialect.PostgreSQLDialect) + - db driver: flys.backend.driver (org.postgresql.Driver) + - db url: flys.backend.url (jdbc:postgresql://localhost:5432/flys) + +2011-03-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Expose createSessionFactory() as public to be usable without + a artifact database running. + +2011-03-16 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/utils/FileTools.java: + Tools for handling with filenames. Currently there is + a repair(File) method with repairs letter case errors + which is useful when reading windows filenames on a + un*x platform. + + * src/main/java/de/intevation/flys/importer/Importer.java: + Standalone app to read data from the file system and + store it in a database. Currently it does not store + anything. It only loads info gew files. + + * src/main/java/de/intevation/flys/importer/InfoGewParser.java: + Info gew parser. + + * src/main/java/de/intevation/flys/importer/ImportRiver.java: + Helper model of a river used produced by parsing the + info gew files. + +2011-03-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + New. SessionFactoryProvider.getSessionFactory() provides a + SessionFactory to use the Hibernate O/R mapper for the FLYS backend. + +2011-03-15 Sascha L. Teichmann + + * pom.xml: Added dependency to artifacts-commons to + be able to use the global configuration of the artifact database. + +2011-03-15 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/App.java: Wire all POJOs + to corresponding factory. + + * src/main/java/de/intevation/flys/model/*.java: Generate + all foreign key constraints. TODO: name them correctly + because the machine generated names are ugly and do + not fit the PostgreSQL names. + + * doc/schema/postgresql.sql: Small quantifier fix in descriptions + of wst columns. + +2011-03-14 Sascha L. Teichmann + + * doc/schema/postgresql.sql: Fixed wrong spelled + column references in foreign keys introduces with + last change. + +2011-03-14 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/*.java: Added + column annotations for simple fields. TODO: foreign keys. + +2011-03-14 Sascha L. Teichmann + + * doc/schema/postgresql.sql, doc/schema/postgresql-cleanup.sql: + Fixed inconsistent table names. + + * src/main/java/de/intevation/flys/model/*.java: Added + entity and id annotations. + +2011-03-14 Sascha L. Teichmann + + * doc/schema/postgresql.sql, doc/schema/postgresql-cleanup.sql: + Added missing sequences. + + * doc/schema/sqlite.sql: Deleted. Not longer supported. + +2011-03-11 Sascha L. Teichmann + + * doc/schema/postgresql-cleanup.sql: Forgot to add. + + * src/main/java/de/intevation/flys/App.java: Use + Apache Commons DBCP as Hibernate connection provide. + + * src/main/java/de/intevation/flys/model/River.java: + Added a constructor with string argument. Set the + sequence increment to 1 (eat up 100 at a time before). + + * pom.xml: Added PostgreSQL 8.4 driver as runtime dependency. + +2011-03-11 Sascha L. Teichmann + + * doc/schema/postgresql-cleanup.sql: New. Tear down schema + for a postgres database. + + * doc/schema/postgresql.sql: Added squence for + auto generating ids in river table. Cleaned up schema. + + * src/main/java/de/intevation/flys/App.java: Simple + test app to interact with hibernate. Needs to be removed + because its only a toy. + + * src/main/java/de/intevation/flys/utils/DBCPConnectionProvider.java: + New. Binds Apache Commons to Hibernate. + + * pom.xml: Added dependencies to log4j, commons dbcp, + JPA of hibernate. + + * src/main/java/de/intevation/flys/model/River.java: Added + JPA annotations. + + * src/main/java/de/intevation/flys/model/*.java: Replaced + Long with Integer because column ids are only four bytes wide. + +2011-03-11 Sascha L. Teichmann + + * doc/schema/sqlite.sql, doc/schema/postgresql.sql: Fixed + smaller issues in ddl. + + * src/main/java/de/intevation/flys/model/*.java: Added POJOs + of to be mapped. TODO: Map them! + + * pom.xml: Added plugin config for hibernate. + +2011-03-09 Sascha L. Teichmann + + * pom.xml: Added dependency (and corresponding repository) to + Hibernate Core 3.6.1 Final + +2011-03-09 Sascha L. Teichmann + + * pom.xml, src/**: Created a new empty maven project: + $ mvn archetype:create \ + -DgroupId=de.intevation.flys \ + -DartifactId=flys-backend + +2011-03-09 Sascha L. Teichmann + + * README: New. Some setup instructions. + + * doc/schema/postgresql.sql: New. Schema converted to PostgreSQL + + * doc/schema/sqlite.sql: Fixed defect foreign key constraints. + +2011-03-09 Sascha L. Teichmann + + * doc/schema/sqlite.sql: Factorized time intervals out into + a separated table. + +2011-01-22 Sascha L. Teichmann + + * contrib/import-kms.py, contrib/import-gew.py: Initial scripts + to import data into SQLite database. They still need some work. + +2011-02-10 Sascha L. Teichmann : + + * doc/schema/sqlite.sql: Added initial schema for + FLYS database. diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/Changes --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/Changes Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,109 @@ +2011-09-19 RELEASE 2.5 + + NEW: + + * Improved the data model to support: + - cross sections + - hyks ("Hydraulische Kenngroessen") + + * Improved the importer to read: + - PRF files + - HYK files + + * Added a central Config to configure the Importer. There are several + system properties to adjust what to import (see ChangeLog for + details). + + * Added a Postgis and Oracle models for spatial flys data: + - catchments + - river axes + - buildings + - fixpoints + - cross section tracks + - hws ("HW-Schutzanlagen") + - floodplains + + * Bumped Hibernate up to 3.6.5. + + * Bumped Apache DBCP up to 1.4. + + + +2011-06-27 RELEASE 2.4 + + New: + + * Improved the data model to support: + - edges ("Oberkante", "Unterkante") + - annotations + + * Improved the importer to read: + - edges + - annotations + + * Made search for gauges in River independent of from/to + kilometer order. + + + Fixes: + + * flys/issue76 Close gaps between q ranges + + * flys/issue110 Fixed import of ATs that skipped the first value. + + + +2011-05-13 RELEASE 2.3 + + New: + + * Import of: + - "zusätzliche Längsschnitte" + - "Fixierungen" + - "amtliche Linien" + - "Hochwassermarken" + - "Historische Abflusskurven" + - "HW-Schutzanlagen" + + * Improvements in the SQL schema: + - Added a 'kind' column to WSTs + - Added a 'position' column to WST columns to enable sorting WST columns. + - Added a 'km_up' column to rivers to determine the flow direction of rivers. + + * Rivers are now able to: + - determine their min/max kilometer range + - determine the selected gauge(s) based on a kilometer range + + * WSTs are able to determine their min/max Q range. + + * Gauges are able to determine their min/max W range. + + * Added a view 'wst_value_table' that aggregates the data to build w/q + value tables. + + * Added one-to-many relation Wst -> WstColumn + + * Speedup of the importer by using an internal caching mechanism. + + * Sta-Parse just accepts the following main value types: 'Q', 'W', 'D' and 'T' + + + Fixes: + + * Fixed import of Q ranges in wst files. + + * Fixed flys/issue19: Do not take km column in wst file as a water level. + + * Fixed flys/issue11 (Diagramm: Fehlerhafte Werte in Abflusskurven) + + * Fixed flys/issue51 (WINFO: Fachdaten am Pegel Perl enthält Sprünge) + + + !!! + + The version number of this release depends on an existing desktop variant of + this software that is in version 2.1. + + !!! + +2011-03-30 RELEASE 0.1 diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/README Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,10 @@ +For the artifact database +# su - postgres +$ createuser --no-createrole --no-superuser --pwprompt --no-createdb artifacts +$ createdb --encoding=UTF-8 --owner artifacts artifactsdb + +For the flys database + +# su - postgres +$ createuser --no-createrole --no-superuser --pwprompt --no-createdb flys +$ createdb --encoding=UTF-8 --owner flys flystest1 diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/dump-schema.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/dump-schema.sh Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,16 @@ +#!/bin/bash + +DB_URL=jdbc:postgresql://czech-republic.atlas.intevation.de:5432/flys3 +DB_USER=flys +DB_PASS=flys +DB_DIALECT=org.hibernatespatial.oracle.OracleSpatial10gDialect + +mvn compile package -e \ + -Dlog4j.configuration=file://`readlink -f contrib/log4j.properties` \ + -Dflys.backend.user=$DB_USER \ + -Dflys.backend.password=$DB_PASS \ + -Dflys.backend.dialect=$DB_DIALECT \ + -Dflys.backend.url=$DB_URL \ + -Dexec.mainClass=de.intevation.flys.App \ + exec:java + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/import-gew.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/import-gew.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,223 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os +import codecs +import re + +HAUPTWERT = re.compile(r"\s*([^\s]+)\s+([^\s+]+)\s+([QWDT-])") +WHITESPACE = re.compile(r"\s+") + +class KM(object): + + def __init__(self, filename): + self.filename = filename + self.load_values() + + def load_values(self): + with codecs.open(self.filename, "r", "latin-1") as f: + for line in f: + line = line.strip() + if not line or line.startswith("*"): + parts = [s.strip() for s in line.split(";")] + # TODO: Use code from import-kms.py + +class AbflussTafel(object): + + def __init__(self, filename): + self.filename = filename + self.name = "" + self.values = [] + self.load_values() + + def load_values(self): + with codecs.open(self.filename, "r", "latin-1") as f: + first = True + for line in f: + line = line.strip() + if not line: continue + if line.startswith("#! name="): + self.name = line[8:] + continue + if line.startswith("#") or line.startswith("*"): + continue + line = line.replace(",", ".") + splits = WHITESPACE.split(line) + + if len(splits) < 2 or len(splits) > 11: + continue + + w = float(splits[0]) + + shift = 0 + + if len(splits) != 11 and first: + shift = 11 - len(splits) + + for idx, q in enumerate(splits[1:]): + i_w = w + shift + idx + i_q = float(q) + w_q = (i_w/100.0, i_q/100.0) + self.values.append(w_q) + + first = False + + +class Hauptwert(object): + def __init__(self, name, value, kind): + self.name = name + self.extra = value + self.kind = kind + +class Pegel(object): + def __init__(self, name, start, stop, sta, at, html): + self.name = name + self.start = start + self.stop = stop + self.sta = sta + self.at = at + self.html = html + self.aeo = 0.0 + self.nullpunkt = 0.0 + self.km = 0.0 + self.hauptwerte = [] + self.load_hauptwerte() + self.at_data = AbflussTafel(self.at) + + def load_hauptwerte(self): + with codecs.open(self.sta, "r", "latin-1") as f: + for line_no, line in enumerate(f): + line = line.rstrip() + if line_no == 0: + first = False + name = line[16:37].strip() + line = [s.replace(",", ".") for s in line[37:].split()] + self.aeo = float(line[0]) + self.nullpunkt = float(line[1]) + print >> sys.stderr, "pegel name: '%s'" % name + print >> sys.stderr, "pegel aeo: '%f'" % self.aeo + print >> sys.stderr, "pegel nullpunkt: '%f'" % self.nullpunkt + elif line_no == 1: + self.km = float(line[29:36].strip().replace(",", ".")) + print >> sys.stderr, "km: '%f'" % self.km + else: + if not line: continue + line = line.replace(",", ".") + m = HAUPTWERT.match(line) + if not m: continue + self.hauptwerte.append(Hauptwert( + m.group(1), float(m.group(2)), m.group(3))) + +class Gewaesser(object): + + def __init__(self, name=None, b_b=None, wst=None): + self.name = name + self.b_b = b_b + self.wst = wst + self.pegel = [] + + def load_pegel(self): + dir_name = os.path.dirname(self.wst) + pegel_glt = find_file(dir_name, "PEGEL.GLT") + if not pegel_glt: + print >> sys.stderr, "Missing PEGEL.GLT for %r" % self.name + return + + print >> sys.stderr, "pegel_glt: %r" % pegel_glt + + with codecs.open(pegel_glt, "r", "latin-1") as f: + for line in f: + line = line.strip() + if not line or line.startswith("#"): + continue + # using re to cope with quoted columns, + # shlex has unicode problems. + parts = [p for p in re.split("( |\\\".*?\\\"|'.*?')", line) + if p.strip()] + if len(parts) < 7: + print >> sys.stderr, "too less colums (need 7): %r" % line + continue + + print >> sys.stderr, "%r" % parts + self.pegel.append(Pegel( + parts[0], + min(float(parts[2]), float(parts[3])), + max(float(parts[2]), float(parts[3])), + norm_path(parts[4], dir_name), + norm_path(parts[5], dir_name), + parts[6])) + + + def __repr__(self): + return u"Gewaesser(name=%r, b_b=%r, wst=%r)" % ( + self.name, self.b_b, self.wst) + +def norm_path(path, ref): + if not os.path.isabs(path): + path = os.path.normpath(os.path.join(ref, path)) + return path + +def find_file(path, what): + what = what.lower() + for filename in os.listdir(path): + p = os.path.join(path, filename) + if os.path.isfile(p) and filename.lower() == what: + return p + return None + + +def read_gew(filename): + + gewaesser = [] + + current = Gewaesser() + + filename = os.path.abspath(filename) + dirname = os.path.dirname(filename) + + with codecs.open(filename, "r", "latin-1") as f: + for line in f: + line = line.strip() + if not line or line.startswith("*"): + continue + + if line.startswith(u"Gewässer:"): + if current.name: + gewaesser.append(current) + current = Gewaesser() + current.name = line[len(u"Gewässer:"):].strip() + elif line.startswith(u"B+B-Info:"): + current.b_b = norm_path(line[len(u"B+B-Info:"):].strip(), + dirname) + elif line.startswith(u"WSTDatei:"): + current.wst = norm_path(line[len(u"WSTDatei:"):].strip(), + dirname) + + if current.name: + gewaesser.append(current) + + return gewaesser + +def main(): + + if len(sys.argv) < 2: + print >> sys.stderr, "missing gew file" + sys.exit(1) + + gew_filename = sys.argv[1] + + if not os.path.isfile(gew_filename): + print >> sys.stderr, "'%s' is not a file" % gew_filename + sys.exit(1) + + gewaesser = read_gew(gew_filename) + + for gew in gewaesser: + gew.load_pegel() + + + +if __name__ == '__main__': + main() +# vim: set fileencoding=utf-8 : diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/import-kms.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/import-kms.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,213 @@ +#!/usr/bin/env python + +import sys +import logging +import re +import os + +import sqlite3 as db +import locale +import codecs + +from optparse import OptionParser + +log = logging.getLogger(__name__) +log.setLevel(logging.WARNING) +log.addHandler(logging.StreamHandler(sys.stderr)) + +RANGE = re.compile("([^#]*)#(.*)") +DEFAULT_DATABASE = "flys.db" + +SQL_NEXT_ID = "SELECT coalesce(max(id), -1) + 1 FROM %s" +SQL_SELECT_ID = "SELECT id FROM %s WHERE %s = ?" +SQL_INSERT_ID = "INSERT INTO %s (id, %s) VALUES (?, ?)" + +SQL_SELECT_RANGE_ID = """ +SELECT id FROM ranges WHERE river_id = ? AND a = ? AND b = ? +""" +SQL_INSERT_RANGE_ID = """ +INSERT INTO ranges (id, river_id, a, b) VALUES (?, ?, ?, ?) +""" +SQL_SELECT_ANNOTATION_ID = """ +SELECT id FROM annotations +WHERE range_id = ? AND attribute_id = ? AND position_id = ? +""" +SQL_INSERT_ANNOTATION_ID = """ +INSERT INTO annotations (id, range_id, attribute_id, position_id) +VALUES (?, ?, ?, ?) +""" + +def encode(s): + try: + return unicode(s, "latin-1") + except UnicodeDecodeError: + return unicode.encode(s, locale.getpreferredencoding()) + +class hashabledict(dict): + def __key(self): + return tuple((k, self[k]) for k in sorted(self)) + def __hash__(self): + return hash(self.__key()) + def __eq__(self, other): + return self.__key() == other.__key() + +def cache(f): + def func(*args, **kw): + key = (args, hashabledict(kw)) + try: + return f.__cache__[key] + except KeyError: + value = f(*args, **kw) + f.__cache__[key] = value + return value + f.__cache__ = {} + return func + +NEXT_IDS = {} +def next_id(cur, relation): + idx = NEXT_IDS.get(relation) + if idx is None: + cur.execute(SQL_NEXT_ID % relation) + idx = cur.fetchone()[0] + NEXT_IDS[relation] = idx + 1 + return idx + +def get_id(cur, relation, attribute, value): + select_stmt = SQL_SELECT_ID % (relation, attribute) + #log.debug(select_stmt) + cur.execute(select_stmt, (value,)) + row = cur.fetchone() + if row: return row[0] + idx = next_id(cur, relation) + insert_stmnt = SQL_INSERT_ID % (relation, attribute) + #log.debug(insert_stmnt) + cur.execute(insert_stmnt, (idx, value)) + cur.connection.commit() + log.debug("insert %s '%s' id: '%d'" % (relation, value, idx)) + return idx + +#@cache +def get_river_id(cur, name): + return get_id(cur, "rivers", "name", name) + +#@cache +def get_attribute_id(cur, value): + return get_id(cur, "attributes", "value", value) + +#@cache +def get_position_id(cur, value): + return get_id(cur, "positions", "value", value) + +#@cache +def get_range_id(cur, river_id, a, b): + cur.execute(SQL_SELECT_RANGE_ID, (river_id, a, b)) + row = cur.fetchone() + if row: return row[0] + idx = next_id(cur, "ranges") + cur.execute(SQL_INSERT_RANGE_ID, (idx, river_id, a, b)) + cur.connection.commit() + return idx + +#@cache +def get_annotation_id(cur, range_id, attribute_id, position_id): + cur.execute(SQL_SELECT_ANNOTATION_ID, ( + range_id, attribute_id, position_id)) + row = cur.fetchone() + if row: return row[0] + idx = next_id(cur, "annotations") + cur.execute(SQL_INSERT_ANNOTATION_ID, ( + idx, range_id, attribute_id, position_id)) + cur.connection.commit() + return idx + +def files(root, accept=lambda x: True): + if os.path.isfile(root): + if accept(root): yield root + elif os.path.isdir(root): + stack = [ root ] + while stack: + cur = stack.pop() + for f in os.listdir(cur): + p = os.path.join(cur, f) + if os.path.isdir(p): + stack.append(p) + elif os.path.isfile(p) and accept(p): + yield p + +def feed_km(cur, river_id, km_file): + + log.info("processing: %s" % km_file) + + for line in codecs.open(km_file, "r", "latin-1"): + line = line.strip() + if not line or line.startswith('*'): + continue + parts = [x.strip() for x in line.split(';')] + if len(parts) < 3: + log.error("cannot process: '%s'" % line) + continue + m = RANGE.match(parts[2]) + try: + if m: + x = [float(x.replace(",", ".")) for x in m.groups()] + a, b = min(x), max(x) + if a == b: b = None + else: + a, b = float(parts[2].replace(",", ".")), None + except ValueError: + log.error("cannot process: '%s'" % line) + continue + + attribute = parts[0] + position = parts[1] + attribute_id = get_attribute_id(cur, attribute) if attribute else None + position_id = get_position_id(cur, position) if position else None + + range_id = get_range_id(cur, river_id, a, b) + + get_annotation_id(cur, range_id, attribute_id, position_id) + +def main(): + + usage = "usage: %prog [options] river km-file ..." + parser = OptionParser(usage=usage) + parser.add_option( + "-v", "--verbose", action="store_true", + dest="verbose", + help="verbose output") + parser.add_option( + "-r", "--recursive", action="store_true", + dest="recursive", default=False, + help="recursive") + parser.add_option( + "-d", "--database", action="store", + dest="database", + help="database to connect with", + default=DEFAULT_DATABASE) + + options, args = parser.parse_args() + + if options.verbose: + log.setLevel(logging.INFO) + + if len(args) < 1: + log.error("missing river argument") + sys.exit(1) + + river = unicode(args[0], locale.getpreferredencoding()) + + with db.connect(options.database) as con: + cur = con.cursor() + river_id = get_river_id(cur, river) + + for arg in args[1:]: + if options.recursive: + for km_file in files( + arg, lambda x: x.lower().endswith(".km")): + feed_km(cur, river_id, km_file) + else: + feed_km(cur, river_id, arg) + + +if __name__ == '__main__': + main() diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/run_geo.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/run_geo.sh Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,50 @@ +#!/bin/sh + +# Required +RIVER_PATH="/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar" +RIVER_ID=1 +TARGET_SRS=31467 +HOST=localhost +USER=flys28 +PASS=flys28 + +# Optional +VERBOSE=1 +SKIP_AXIS=0 +SKIP_KMS=0 +SKIP_CROSSSECTIONS=0 +SKIP_LINES=0 +SKIP_FIXPOINTS=0 +SKIP_BUILDINGS=0 +SKIP_FLOODPLAINS=0 +SKIP_HYDR_BOUNDARIES=0 +SKIP_HWS=0 +SKIP_GAUGE_LOCATION=0 +SKIP_CATCHMENTS=0 +SKIP_UESG=0 + + +DIR=`dirname $0` +DIR=`readlink -f "$DIR"` + +exec python $DIR/shpimporter/shpimporter.py \ + --directory $RIVER_PATH \ + --river_id $RIVER_ID \ + --target_srs $TARGET_SRS \ + --host $HOST \ + --user $USER \ + --password $PASS \ + --verbose $VERBOSE \ + --skip_axis $SKIP_AXIS \ + --skip_kms $SKIP_KMS \ + --skip_crosssections $SKIP_CROSSSECTIONS \ + --skip_lines $SKIP_LINES \ + --skip_fixpoints $SKIP_FIXPOINTS \ + --skip_buildings $SKIP_BUILDINGS \ + --skip_floodplains $SKIP_FLOODPLAINS \ + --skip_hydr_boundaries $SKIP_HYDR_BOUNDARIES \ + --skip_hws $SKIP_HWS \ + --skip_gauge_locations $SKIP_GAUGE_LOCATION \ + --skip_catchments $SKIP_CATCHMENTS \ + --skip_uesgs $SKIP_UESG + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/run_hydr_morph.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/run_hydr_morph.sh Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,103 @@ +#!/bin/bash + +######################### CONFIG OPTIONS ############################ +INFO_GEW="/vol1/projects/Geospatial/flys-3.0/testdaten/saar.gew" +BACKEND_USER="flys28" +BACKEND_PASS="flys28" +BACKEND_HOST="czech-republic.atlas.intevation.de" +BACKEND_PORT="1521" +BACKEND_NAME="XE" +LOG4J_CONFIG="conf/log4j.properties" +##################################################################### + + +########################## Oracle Settings ########################## +BACKEND_DB_PREFIX="jdbc:oracle:thin:@" +BACKEND_DB_DRIVER="oracle.jdbc.OracleDriver" +BACKEND_DB_DIALECT="org.hibernate.dialect.OracleDialect" +BACKEND_URL=$BACKEND_DB_PREFIX//$BACKEND_HOST:$BACKEND_PORT/$BACKEND_NAME +##################################################################### + + +######################## Custom Importer Settings ################### +IMPORTER_DRY_RUN=false +IMPORTER_MAINVALUE_TYPES=QWTD +IMPORTER_ANNOTATION_TYPES="conf/annotation-types.xml" + +IMPORTER_SKIP_GAUGES=false +IMPORTER_SKIP_ANNOTATIONS=false +IMPORTER_SKIP_WST=false +IMPORTER_SKIP_PRFS=false +IMPORTER_SKIP_HYKS=false +IMPORTER_SKIP_EXTRA_WST=false +IMPORTER_SKIP_FIXATIONS=false +IMPORTER_SKIP_OFFICIAL_LINES=false +IMPORTER_SKIP_FLOOD_WATER=false +IMPORTER_SKIP_FLOOD_PROTECTION=false + +IMPORTER_SKIP_BED_HEIGHT_SINGLE=false +IMPORTER_SKIP_BED_HEIGHT_EPOCH=false +IMPORTER_SKIP_SEDIMENT_DENSITY=false +IMPORTER_SKIP_MORPHOLOGICAL_WIDTH=false +IMPORTER_SKIP_FLOW_VELOCITY=false +IMPORTER_SKIP_SEDIMENT_YIELD=false +IMPORTER_SKIP_WATERLEVELS=false +IMPORTER_SKIP_WATERLEVEL_DIFFERENCES=false +IMPORTER_SKIP_SQ_RELATION=false +##################################################################### + +#MIN_MEMORY="8192m" +MIN_MEMORY="1024m" + + +########################## Importer Settings ######################## +APP="de.intevation.flys.importer.Importer" +DIR=`dirname $0` +DIR=`readlink -f "$DIR/.."` +##################################################################### + + +########################## Collect required libraries ############### +CLASSPATH= +for l in `find "$DIR/lib" -name \*.jar -print`; do + CLASSPATH=$CLASSPATH:$l +done + +export CLASSPATH +##################################################################### + + +######################### Run Importer ############################## +exec java \ + -Xmx$MIN_MEMORY \ + -server \ + -Dlog4j.configuration=file://`readlink -f $LOG4J_CONFIG` \ + -Dflys.backend.importer.infogew.file=$INFO_GEW \ + -Dflys.backend.main.value.types=$IMPORTER_MAINVALUE_TYPES \ + -Dflys.backend.importer.annotation.types=$IMPORTER_ANNOTATION_TYPES \ + -Dflys.backend.importer.dry.run=$IMPORTER_DRY_RUN \ + -Dflys.backend.importer.skip.gauges=$IMPORTER_SKIP_GAUGES \ + -Dflys.backend.importer.skip.annotations=$IMPORTER_SKIP_ANNOTATIONS \ + -Dflys.backend.importer.skip.prfs=$IMPORTER_SKIP_PRFS \ + -Dflys.backend.importer.skip.hyks=$IMPORTER_SKIP_HYKS \ + -Dflys.backend.importer.skip.wst=$IMPORTER_SKIP_WST \ + -Dflys.backend.importer.skip.extra.wsts=$IMPORTER_SKIP_EXTRA_WST \ + -Dflys.backend.importer.skip.fixations=$IMPORTER_SKIP_FIXATIONS \ + -Dflys.backend.importer.skip.official.lines=$IMPORTER_SKIP_OFFICIAL_LINES \ + -Dflys.backend.importer.skip.flood.water=$IMPORTER_SKIP_FLOOD_WATER \ + -Dflys.backend.importer.skip.flood.protection=$IMPORTER_SKIP_FLOOD_PROTECTION \ + -Dflys.backend.importer.skip.bed.height.single=$IMPORTER_SKIP_BED_HEIGHT_SINGLE \ + -Dflys.backend.importer.skip.bed.height.epoch=$IMPORTER_SKIP_BED_HEIGHT_EPOCH \ + -Dflys.backend.importer.skip.sediment.density=$IMPORTER_SKIP_SEDIMENT_DENSITY \ + -Dflys.backend.importer.skip.morphological.width=$IMPORTER_SKIP_MORPHOLOGICAL_WIDTH \ + -Dflys.backend.importer.skip.flow.velocity=$IMPORTER_SKIP_FLOW_VELOCITY \ + -Dflys.backend.importer.skip.sediment.yield=$IMPORTER_SKIP_SEDIMENT_YIELD \ + -Dflys.backend.importer.skip.waterlevels=$IMPORTER_SKIP_WATERLEVELS \ + -Dflys.backend.importer.skip.waterlevel.differences=$IMPORTER_SKIP_WATERLEVEL_DIFFERENCES \ + -Dflys.backend.importer.skip.sq.relation=$IMPORTER_SKIP_SQ_RELATION \ + -Dflys.backend.user=$BACKEND_USER \ + -Dflys.backend.password=$BACKEND_PASS \ + -Dflys.backend.url=$BACKEND_URL \ + -Dflys.backend.driver=$BACKEND_DB_DRIVER \ + -Dflys.backend.dialect=$BACKEND_DB_DIALECT \ + $APP diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/axis.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/axis.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,52 @@ +import ogr + +from importer import Importer +import shpimporter + +NAME="Axis" +TABLE_NAME="river_axes" +PATH="Geodaesie/Flussachse+km" + + +class Axis(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 + + + def isShapeRelevant(self, name, path): + return name == "achse" or name.find("achse") >= 0 + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + newFeat.SetGeometry(feat.GetGeometryRef()) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + riverId = feat.GetField("river_id") + else: + riverId = self.river_id + + if self.IsFieldSet(feat, "kind"): + kind = feat.GetField("kind") + else: + kind = 0 + + newFeat.SetField("river_id", riverId) + newFeat.SetField("kind", kind) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/boundaries.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/boundaries.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,91 @@ +import ogr + +from importer import Importer + +TABLE_NAME="hydr_boundaries" +TABLE_NAME_POLY="hydr_boundaries_poly" +PATH="Hydrologie/Hydr.Grenzen/Linien" +NAME="Hydr. Boundaries" + + +class HydrBoundary(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 + + + def isShapeRelevant(self, name, path): + return True + + + def getKind(self, path): + if path.find("BfG") > 0: + return 1 + else: + return 2 + + + def createNewFeature(self, featureDef, feat, **args): + kind = self.getKind(args['path']) + + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + newFeat.SetField("name", args['name']) + newFeat.SetField("kind", kind) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + return newFeat + + + +class HydrBoundaryPoly(HydrBoundary): + + def getTablename(self): + return TABLE_NAME_POLY + + + def getName(self): + return "%s (Polygons)" % NAME + + + def isGeometryValid(self, geomType): + return geomType == 3 or geomType == 6 + + + def createNewFeature(self, featureDef, feat, **args): + kind = self.getKind(args['path']) + + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + newFeat.SetField("name", args['name']) + newFeat.SetField("kind", kind) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/buildings.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/buildings.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,47 @@ +import ogr + +from importer import Importer + +TABLE_NAME="buildings" +PATH="Geodaesie/Bauwerke" +NAME="Buildings" + + +class Building(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + newFeat.SetGeometry(feat.GetGeometryRef()) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "Name"): + newFeat.SetField("name", feat.GetField("Name")) + elif self.IsFieldSet(feat, "KWNAAM"): + newFeat.SetField("name", feat.GetField("KWNAAM")) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/catchments.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/catchments.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,53 @@ +import ogr + +from importer import Importer + +TABLE_NAME="catchment" +PATH="Hydrologie/Einzugsgebiet" +NAME="Catchments" + + +class Catchment(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 3 or geomType == 6 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "Name"): + newFeat.SetField("name", feat.GetField("name")) + else: + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "AREA"): + newFeat.SetField("area", feat.GetField("area")) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/crosssectiontracks.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/crosssectiontracks.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,57 @@ +import ogr + +from importer import Importer + +TABLE_NAME="cross_section_tracks" +PATH="Geodaesie/Querprofile" +NAME="Crosssections" + + +class CrosssectionTrack(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + newFeat.SetGeometry(feat.GetGeometryRef()) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "KILOMETER"): + newFeat.SetField("km", feat.GetFieldAsDouble("KILOMETER")) + elif self.IsFieldSet(feat, "KM"): + newFeat.SetField("km", feat.GetFieldAsDouble("KM")) + elif self.IsFieldSet(feat, "STATION"): + newFeat.SetField("km", feat.GetFieldAsDouble("STATION")) + else: + return None + + if self.IsFieldSet(feat, "ELEVATION"): + newFeat.SetField("z", feat.GetFieldAsDouble("ELEVATION")) + else: + newFeat.SetField("z", 0) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/fixpoints.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/fixpoints.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,61 @@ +import ogr, osr + +from importer import Importer + +TABLE_NAME="fixpoints" +PATH="Geodaesie/Festpunkte" +NAME="Fixpoints" + + +class Fixpoint(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 1 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + + newFeat.SetGeometry(geometry) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "KM"): + newFeat.SetField("km", feat.GetFieldAsDouble("KM")) + elif self.IsFieldSet(feat, "ELBE_KM"): + newFeat.SetField("km", feat.GetFieldAsDouble("ELBE_KM")) + else: + return None + + if self.IsFieldSet(feat, "X"): + newFeat.SetField("x", feat.GetFieldAsDouble("X")) + + if self.IsFieldSet(feat, "Y"): + newFeat.SetField("y", feat.GetFieldAsDouble("Y")) + + if self.IsFieldSet(feat, "HPGP"): + newFeat.SetField("HPGP", feat.GetField("HPGP")) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/floodplains.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/floodplains.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,45 @@ +import ogr + +from importer import Importer + +TABLE_NAME="floodplain" +PATH="Hydrologie/Hydr.Grenzen" +NAME="Floodplains" + + +class Floodplain(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 3 or geomType == 6 + + + def isShapeRelevant(self, name, path): + return name.find("talaue") >= 0 + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + + newFeat.SetGeometry(geometry) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/gauges.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/gauges.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,52 @@ +import ogr + +from importer import Importer + +TABLE_NAME="gauge_location" +PATH="Hydrologie/Streckendaten" +NAME="Gauge locations" + + +class GaugeLocation(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 1 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "Name"): + newFeat.SetField("name", feat.GetField("name")) + elif self.IsFieldSet(feat, "MPNAAM"): + newFeat.SetField("name", feat.GetField("MPNAAM")) + else: + newFeat.SetField("name", args['name']) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/hws.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/hws.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,56 @@ +import ogr + +from importer import Importer + +TABLE_NAME="hws" +PATH="Hydrologie/HW-Schutzanlagen" +NAME="HWS" + + +class HWS(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "TYP"): + newFeat.SetField("type", feat.GetField("TYP")) + + if self.IsFieldSet(feat, "Bauart"): + newFeat.SetField("hws_facility", feat.GetField("Bauart")) + + if self.IsFieldSet(feat, "Name"): + newFeat.SetField("name", feat.GetField("name")) + else: + newFeat.SetField("name", args['name']) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/importer.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/importer.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,147 @@ +import ogr, osr +import shpimporter + +class Importer: + + def __init__(self, config): + self.config = config + self.dbconn = 'OCI:%s/%s@%s' % (config.user, config.password, config.host) + self.river_id = config.river_id + self.dest_srs = osr.SpatialReference() + self.dest_srs.ImportFromEPSG(config.target_srs) + + + def getKind(self, path): + raise NotImplementedError("Importer.getKind is abstract!") + + + def getPath(self, base): + raise NotImplementedError("Importer.getPath is abstract!") + + + def getTablename(self): + raise NotImplementedError("Importer.getTablename is abstract!") + + + def getName(self): + raise NotImplementedError("Importer.getTablename is abstract!") + + + def IsFieldSet(self, feat, name): + try: + isset = feat.GetField(name) + return isset is not None + except: + return False + + + def IsDoubleFieldSet(self, feat, name): + try: + isset = feat.GetFieldAsDouble(name) + return isset is not None + except: + return False + + + def isShapeRelevant(self, name, path): + return True + + + def walkOverShapes(self, shape): + (name, path) = shape + if not self.isShapeRelevant(name, path): + shpimporter.INFO("Skip shapefile '%s'" % path) + return + + shp = ogr.Open(shape[1]) + if shp is None: + shpimporter.ERROR("Shapefile '%s' could not be opened!" % path) + return + + shpimporter.INFO("Processing shapefile '%s'" % path) + srcLayer = shp.GetLayerByName(name) + + if srcLayer is None: + shpimporter.ERROR("Layer '%s' was not found!" % name) + return + + return self.shape2Database(srcLayer, name, path) + + + def transform(self, feat): + geometry = feat.GetGeometryRef() + src_srs = geometry.GetSpatialReference() + + if src_srs is None: + shpimporter.ERROR("No source SRS given! No transformation possible!") + return feat + + transformer = osr.CoordinateTransformation(src_srs, self.dest_srs) + geometry.Transform(transformer) + + return feat + + + def shape2Database(self, srcLayer, name, path): + table = ogr.Open(self.dbconn) + destLayer = table.GetLayerByName(self.getTablename()) + + if srcLayer is None: + shpimporter.ERROR("Shapefile is None!") + return -1 + + if destLayer is None: + shpimporter.ERROR("No destination layer given!") + return -1 + + count = srcLayer.GetFeatureCount() + shpimporter.DEBUG("Try to add %i features to database." % count) + + srcLayer.ResetReading() + + geomType = -1 + success = 0 + unsupported = 0 + creationFailed = 0 + featureDef = destLayer.GetLayerDefn() + + for feat in srcLayer: + geom = feat.GetGeometryRef() + + if geom is None: + continue + + geomType = geom.GetGeometryType() + + if self.isGeometryValid(geomType): + newFeat = self.createNewFeature(featureDef, + feat, + name=name, + path=path) + + if newFeat is not None: + newFeat.SetField("path", path) + newFeat = self.transform(newFeat) + res = destLayer.CreateFeature(newFeat) + if res is None or res > 0: + shpimporter.Error("Unable to insert feature: %r" % res) + else: + success = success + 1 + else: + creationFailed = creationFailed + 1 + else: + unsupported = unsupported + 1 + + shpimporter.INFO("Inserted %i features" % success) + shpimporter.INFO("Failed to create %i features" % creationFailed) + shpimporter.INFO("Found %i unsupported features" % unsupported) + + try: + if self.config.dry_run > 0: + return geomType + destLayer.CommitTransaction() + except e: + shpimporter.ERROR("Exception while committing transaction.") + + return geomType + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/km.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/km.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,50 @@ +import ogr + +from importer import Importer + +TABLE_NAME="river_axes_km" +PATH="Geodaesie/Flussachse+km" +NAME="KMS" + + +class KM(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 1 + + + def isShapeRelevant(self, name, path): + return name == "km" + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + newFeat.SetGeometry(feat.GetGeometryRef()) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsDoubleFieldSet(feat, "km"): + newFeat.SetField("km", feat.GetFieldAsDouble("km")) + elif self.IsDoubleFieldSet(feat, "KM"): + newFeat.SetField("km", feat.GetFieldAsDouble("KM")) + else: + return None + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/lines.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/lines.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,56 @@ +import ogr + +from importer import Importer + +TABLE_NAME="lines" +PATH="Geodaesie/Linien" +NAME="Lines" + + +class Line(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + return geomType == 2 or geomType == -2147483646 + + + def isShapeRelevant(self, name, path): + return True + + + def createNewFeature(self, featureDef, feat, **args): + newFeat = ogr.Feature(featureDef) + geometry = feat.GetGeometryRef() + geometry.SetCoordinateDimension(2) + + newFeat.SetGeometry(geometry) + newFeat.SetField("name", args['name']) + + if self.IsFieldSet(feat, "river_id"): + newFeat.SetField("river_id", feat.GetField("river_id")) + else: + newFeat.SetField("river_id", self.river_id) + + if self.IsFieldSet(feat, "TYP"): + newFeat.SetField("kind", feat.GetFieldAsDouble("TYP")) + else: + newFeat.SetField("kind", "DAMM") + + if self.IsFieldSet(feat, "Z"): + newFeat.SetField("z", feat.GetFieldAsDouble("Z")) + else: + newFeat.SetField("z", 9999) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/run.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/run.sh Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,46 @@ +#!/bin/sh + +# Required +RIVER_PATH="/path/to/rivers/river" +RIVER_ID=1 +TARGET_SRS=31466 +HOST=localhost +USER=the_user +PASS=the_pass + +# Optional +VERBOSE=1 +SKIP_AXIS=0 +SKIP_KMS=0 +SKIP_CROSSSECTIONS=0 +SKIP_LINES=0 +SKIP_FIXPOINTS=0 +SKIP_BUILDINGS=0 +SKIP_FLOODPLAINS=0 +SKIP_HYDR_BOUNDARIES=0 +SKIP_HWS=0 +SKIP_GAUGE_LOCATION=0 +SKIP_CATCHMENTS=0 +SKIP_UESG=0 + +exec python shpimporter.py \ + --directory $RIVER_PATH \ + --river_id $RIVER_ID \ + --target_srs $TARGET_SRS \ + --host $HOST \ + --user $USER \ + --password $PASS \ + --verbose $VERBOSE \ + --skip_axis $SKIP_AXIS \ + --skip_kms $SKIP_KMS \ + --skip_crosssections $SKIP_CROSSSECTIONS \ + --skip_lines $SKIP_LINES \ + --skip_fixpoints $SKIP_FIXPOINTS \ + --skip_buildings $SKIP_BUILDINGS \ + --skip_floodplains $SKIP_FLOODPLAINS \ + --skip_hydr_boundaries $SKIP_HYDR_BOUNDARIES \ + --skip_hws $SKIP_HWS \ + --skip_gauge_locations $SKIP_GAUGE_LOCATION \ + --skip_catchments $SKIP_CATCHMENTS \ + --skip_uesgs $SKIP_UESG + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/shpimporter.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/shpimporter.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,171 @@ +import ogr + +import utils, optparse + +from uesg import UESG +from axis import Axis +from km import KM +from lines import Line +from fixpoints import Fixpoint +from buildings import Building +from crosssectiontracks import CrosssectionTrack +from floodplains import Floodplain +from boundaries import HydrBoundary, HydrBoundaryPoly +from hws import HWS +from gauges import GaugeLocation +from catchments import Catchment + + +VERBOSE_DEBUG=2 +VERBOSE_INFO=1 + + +def DEBUG(msg): + config = getConfig() + if config.verbose >= VERBOSE_DEBUG: + print "DEBUG: %s" % msg + +def INFO(msg): + config = getConfig() + if config.verbose >= VERBOSE_INFO: + print "INFO: %s" % msg + +def ERROR(msg): + config = getConfig() + print "ERROR: %s" % msg + + +def getImporters(config): + return [ + Axis(config), + KM(config), + CrosssectionTrack(config), + Line(config), + Fixpoint(config), + Building(config), + Floodplain(config), + HydrBoundary(config), + HydrBoundaryPoly(config), + HWS(config), + GaugeLocation(config), + Catchment(config), + UESG(config) + ] + + +def getConfig(): + parser = optparse.OptionParser() + parser.add_option("--directory", type="string") + parser.add_option("--target_srs", type="int") + parser.add_option("--host", type="string") + parser.add_option("--user", type="string") + parser.add_option("--password", type="string") + parser.add_option("--river_id", type="int") + parser.add_option("--verbose", type="int", default=1) + parser.add_option("--dry_run", type="int", default=0) + parser.add_option("--skip_axis", type="int") + parser.add_option("--skip_hydr_boundaries", type="int") + parser.add_option("--skip_buildings", type="int") + parser.add_option("--skip_crosssections", type="int") + parser.add_option("--skip_lines", type="int") + parser.add_option("--skip_fixpoints", type="int") + parser.add_option("--skip_floodplains", type="int") + parser.add_option("--skip_hws", type="int") + parser.add_option("--skip_gauge_locations", type="int") + parser.add_option("--skip_catchments", type="int") + parser.add_option("--skip_kms", type="int") + parser.add_option("--skip_uesgs", type="int") + (config, args) = parser.parse_args() + + if config.directory == None: + ERROR("No river directory specified!") + raise Exception("Invalid config") + elif config.host == None: + ERROR("No database host specified!") + raise Exception("Invalid config") + elif config.user == None: + ERROR("No databaser user specified!") + raise Exception("Invalid config") + elif config.password == None: + ERROR("No password specified!") + raise Exception("Invalid config") + elif config.river_id == None: + ERROR("No river id specified!") + raise Exception("Invalid config") + + return config + + +def skip_importer(config, importer): + if config.skip_axis == 1 and isinstance(importer, Axis): + return True + elif config.skip_hydr_boundaries == 1 and isinstance(importer, HydrBoundary): + return True + elif config.skip_hydr_boundaries == 1 and isinstance(importer, HydrBoundaryPoly): + return True + elif config.skip_buildings == 1 and isinstance(importer, Building): + return True + elif config.skip_crosssections == 1 and isinstance(importer, CrosssectionTrack): + return True + elif config.skip_lines == 1 and isinstance(importer, Line): + return True + elif config.skip_fixpoints == 1 and isinstance(importer, Fixpoint): + return True + elif config.skip_floodplains == 1 and isinstance(importer, Floodplain): + return True + elif config.skip_hws == 1 and isinstance(importer, HWS): + return True + elif config.skip_gauge_locations == 1 and isinstance(importer, GaugeLocation): + return True + elif config.skip_catchments == 1 and isinstance(importer, Catchment): + return True + elif config.skip_kms == 1 and isinstance(importer, KM): + return True + elif config.skip_uesgs == 1 and isinstance(importer, UESG): + return True + + return False + + +def parse(): + config=None + try: + config = getConfig() + except: + return + + if config == None: + ERROR("Unable to read config from command line!") + return + + if config.dry_run > 0: + INFO("You enable 'dry_run'. No database transaction will take place!") + + importers = getImporters(config) + types = {} + + for importer in importers: + if skip_importer(config, importer): + INFO("Skip import of '%s'" % importer.getName()) + continue + + INFO("Start import of '%s'" % importer.getName()) + + shapes = utils.findShapefiles(importer.getPath(config.directory)) + DEBUG("Found %i Shapefiles" % len(shapes)) + + for shpTuple in shapes: + geomType = importer.walkOverShapes(shpTuple) + try: + if geomType is not None: + num = types[geomType] + types[geomType] = num+1 + except: + types[geomType] = 1 + + for key in types: + DEBUG("%i x geometry type %s" % (types[key], key)) + + +if __name__ == '__main__': + parse() diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/uesg.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/uesg.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,94 @@ +import ogr + +from importer import Importer + + +TABLE_NAME="floodmaps" +PATH="Hydrologie/UeSG/Berechnung" +NAME="UESG" + + +class UESG(Importer): + + def getPath(self, base): + return "%s/%s" % (base, PATH) + + + def getTablename(self): + return TABLE_NAME + + + def getName(self): + return NAME + + + def isGeometryValid(self, geomType): + if geomType == 3 or geomType == 6: + return True + else: + return False + + + def getKind(self, path): + kind = 0 + if path.find("Berechnung") > 0: + kind = kind + 100 + + if path.find("Aktuell") > 0: + kind = kind + 10 + else: + kind = kind + 20 + + if path.find("Land") > 0: + kind = kind + 2 + else: + kind = kind + 1 + else: + kind = kind + 200 + + return kind + + + def createNewFeature(self, featureDef, feat, **args): + kind = self.getKind(args['path']) + + newFeat = ogr.Feature(featureDef) + newFeat.SetGeometry(feat.GetGeometryRef()) + + if self.IsFieldSet(feat, "river_id"): + riverId = feat.GetField(feat) + else: + riverId = self.river_id + + if self.IsFieldSet(feat, "diff"): + diff = feat.GetFieldAsDouble("diff") + else: + diff = 0 + + if self.IsFieldSet(feat, "count"): + count = feat.GetFieldAsInteger("count") + else: + count = 0 + + if self.IsFieldSet(feat, "area"): + area = feat.GetFieldAsDouble("area") + else: + area = 0 + + if self.IsFieldSet(feat, "perimeter"): + perimeter = feat.GetFieldAsDouble("perimeter") + else: + perimeter = 0 + + groupId = 2 + + newFeat.SetField("river_id", riverId) + newFeat.SetField("diff", diff) + newFeat.SetField("count", count) + newFeat.SetField("area", area) + newFeat.SetField("perimeter", perimeter) + newFeat.SetField("kind", kind) + newFeat.SetField("name", args['name']) + + return newFeat + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/shpimporter/utils.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/shpimporter/utils.py Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,21 @@ +import os +from shpimporter import DEBUG, INFO, ERROR + +SHP='.shp' + +def findShapefiles(path): + shapes = [] + + for root, dirs, files in os.walk(path): + if len(files) == 0: + continue + + DEBUG("Processing directory '%s' with %i files " % (root, len(files))) + + for f in files: + idx = f.find(SHP) + if (idx+len(SHP)) == len(f): + shapes.append((f.replace(SHP, ''), root + "/" + f)) + + return shapes + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/contrib/spatial-info.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/contrib/spatial-info.sh Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,10 @@ +#!/bin/bash + +mvn -e \ + -Dlog4j.configuration=file://`readlink -f contrib/log4j.properties` \ + -Dflys.backend.user=USER \ + -Dflys.backend.password=PASSWORD \ + -Dflys.backend.url=jdbc:postgresql://THE.DATABASE.HOST:PORT/DBNAME \ + -Dflys.backend.spatial.river=Saar \ + -Dexec.mainClass=de.intevation.flys.backend.SpatialInfo \ + exec:java diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/doc/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/doc/README.txt Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,527 @@ +FLYS3-Importer + +Der FLYS3-Importer dient dazu, hydrologische und morphologische +Gewässerdaten aus dem Dateisystem in die FLYS3-Datenbank zu importieren. +Das Werkzeug orientiert sich hierbei an der Dateihierachie, +so wie sie auch von Desktop-FLYS ausgelesen wird. + +Als Startargument bekommt der Importer den Pfad zu einer +GEW-Datei übergeben. + +Wichtig für den Importer sind in dieser Datei +die Zeilen, die mit "WSTDatei:" beginnen. In ihnen wird der +Pfad zu der zentralen WST-Datei des jeweiligen Gewässers angegeben. +Alle anderen importierten Dateien werden in ihrer Lage relativ zur +Lage dieser Datei betrachtet. + +Das Verhalten des Importes kann mit sogenannten +System-Properties gesteuert werden. Diese werden im +Allgemeinen in der Form -Dkey=value angegeben. + +Will man z.B. mit dem Importer nur in simulierierten Import +durchführen, dann kann dies über die Angabe von +'-Dflys.backend.importer.dry.run=true' erfolgen. + +!!! Der Import geht wie Desktop-FLYS davon aus, dass die Dateien +!!! Latin-1 encodiert vorliegen. + +Für den Importer stellt jeweils der Import eines Gewässers eine +transaktionale Einheit dar. Wird der Import während eines Gewässers +abgebrochen, werden alle Änderungen bzgl. dieses Gewässers zurück gerollt. + +Importierte Daten: + +Der Importer importiert folgende Datentypen: + +- Streckenfavoriten (*.km-Dateien) + Der Import kann mit '-Dflys.backend.importer.skip.annotations=true' + unterdrückt werden. + + Zur Klassifikation von Streckenfavoriten kann mit + -Dflys.backend.importer.annotation.types=DATEI + der Pfad zu einer XML-Datei angegeben werden, in der über + Regeln festgelegt wird, wie diese geschehen soll. + Details hierzu im Anhang 'Klassifikation von Streckenfavoriten'. + +- Pegel, Stammdaten (*.glt, *.sta-Dateien): + Der Import kann mit '-Dflys.backend.importer.skip.gauges=true' + unterdrückt werden. + Die .glt-Datei, die neben der .wst-Datei liegt, wird zuerst + ausgelesen. Es werden nur *.sta-Datei von Pegeln geladen, die + in der .glt-Datei vermerkt sind. + + Wenn "-Dflys.backend.sta.parse.gauge.numbers=true' wird versucht, + die offiziellen Pegelnummern aus den Stammdaten zu extrahieren. + !!! Dies ist mit Vorsicht zu behandeln, denn die meisten STA-Dateien + !!! Enthalten invalide Pegelnummern. + + Die System-Property "flys.backend.main.value.types" kann einen + String mit gültigen Typen von Stammdaten enthalten. Vorbelegt + ist "QWTD". In der Praxis ist "QWD" eine sinnvolle Belegung. + +- Basis-Wasserstände (gewaesser.wst-Dateien): + Der Import kann mit '-Dflys.backend.importer.skip.wst=true' + unterdrückt werden. + +- Zusätzliche Längsschnitte (*.zus, *.wst-Dateien) + Der Import kann mit '-Dflys.backend.importer.skip.extra.wsts=true' + unterdrückt werden. + Es werden die *.zus- und *.wst-Dateien aus dem Verzeichnis + "../Zus.Längsschnitte" relativ zur gewaesser.wst-Datei betrachtet. + +- Fixierungen (*.wst-Dateien) + Der Import kann mit '-Dflys.backend.importer.skip.fixations=true' + unterdrückt werden. + Es werden die *.wst-Dateien aus dem Verzeichnis + "../Fixierungen" relativ zur gewaesser.wst-Datei betrachtet. + +- Amtliche Linien (*.wst-Dateien) + Der Import kann mit '-Dflys.backend.importer.skip.official.lines=true' + unterdrückt werden. + Es werden die "Amtl_Linien.wst"-Dateien aus dem Verzeichnis + "../Basisdaten" und "../Fixierungen" relativ zur gewaesser.wst-Datei betrachtet. + +- Profilspuren (*.prf-Dateien) + Der Import kann mit '-Dflys.backend.importer.skip.prfs=true' + unterdrückt werden. + Es werden rekursiv alle *.prf-Dateien aus "../../.." relativ + zur gewaesser.wst-Datei betrachtet. Vor dem Import werden + mithilfe eines Längen- und eines MD5-Summen-Vergleichs + inhaltliche Duplikate ausgeschlossen. + +- Hydraulische Kennzahlen (*.hyk) + Der Import kann mit '-Dflys.backend.importer.skip.hyks=true' + unterdrückt werden. + Es werden rekursiv alle *.hyk-Dateien aus "../../.." relativ + zur gewaesser.wst-Datei betrachtet. Vor dem Import werden + mithilfe eines Längen- und eines MD5-Summen-Vergleichs + inhaltliche Duplikate ausgeschlossen. + +- Hochwassermarken (*.zus, *.wst) + Der Import kann mit '-Dflys.backend.importer.skip.flood.water=true' + unterdrückt werden. + Es werden die *.zus- und *.wst-Dateien aus dem Verzeichnis + "../HW-Marken" relativ zur gewaesser.wst-Datei betrachtet. + +- Hochwasserschutzanlagen (*.zus) + Der Import kann mit '-Dflys.backend.importer.skip.flood.protection=true' + unterdrückt werden. + Es werden die *.zus- und *.wst-Dateien aus dem Verzeichnis + "../HW-Schutzanlagen" relativ zur gewaesser.wst-Datei betrachtet. + + TODO INGO: + + flys.backend.importer.skip.bed.height.single + flys.backend.importer.skip.bed.height.epoch + flys.backend.importer.skip.sediment.density + flys.backend.importer.skip.morphological.width + flys.backend.importer.skip.flow.velocity + flys.backend.importer.skip.sediment.yield + flys.backend.importer.skip.waterlevels + flys.backend.importer.skip.waterlevel.differences + flys.backend.importer.skip.sq.relation + +Für die Verbindung zur Datenbank ist es nötig, dem Import +die Verbindungsdaten zu übergeben. Dies geschieht ebenfalls +über System-Properties: + + -Dflys.backend.user=NUTZER + Datenbanknutzer + + -Dflys.backend.password=PASSWORT + Datenbankpasswort + + -Dflys.backend.url=URL + URL zur Datenbank. Typische wäre im Fall einer Oracle-XE-Edition z.B.: + jdbc:oracle:thin:@//RECHNER:PORT/XE + mit RECHNER Name des Servers, auf dem die Datenbank läuft + und PORT der Port auf dem die Datenbank konkret zu erreichen ist. + Weitere Details unter http://www.orafaq.com/wiki/JDBC + + -Dflys.backend.driver=TREIBER + mit TREIBER dem Namen des JDBC-Treibers, der es erlaubt + das Protokoll der Datenbank zu sprechen. Im Falle + einer Oracle XE wäre dies z.B.: + oracle.jdbc.OracleDriver + + -Dflys.backend.dialect=DIALECT + mit DIALECT dem Hibernate-Dialekt, den die Datenbank versteht. + Im Falle eine Oracle-XE wäre dies z.B.: + org.hibernate.dialect.OracleDialect + + +Hinweise zum Betrieb: +--------------------- + + Der Speicherverbrauch des Importers ist sehr hoch. Es ist empfehlenswert, + der JVM mindestens 8GiB Hauptspeicher zuzuordnen: '-Xmx8192m' + Besonders speicherintensiv ist der Import der HYKs und der PRFs. + Hier ist es unter Umständen empfehlenswert, diese in zwei oder drei + Schritten zu importieren. Zuerst die sonstigen hydrologischen Daten + (hierbei mit flys.backend.importer.skip.hyks=true und flys.backend.importer.skip.prfs + den Import der HYKs und PRFs verhindern). Dann die HYKs (mit flys.backend.importer.skip.* + der anderen Daten) und im finalen Schritt dann die PRFs. + +Anhang 'Klassifikation von Streckenfavoriten' +--------------------------------------------- +Streckenfavoriten werden aus KM-Dateien importiert. Um die einzelnen Einträge +eine Kategorie (Brücken, Pegel, etc.) zuzuordnen, kann eine XML angegeben werden, +in der Regeln für diese Klassifikation definiert werden. Schematisch gliedert +sich diese Datei in die zwei Bereiche 'types' und 'patterns': + + + ... + ... + + +In der Sektion 'types' werden die Kategorien vereinbart, in die +klassifiziert werden sollen. Die geschieht mit einzelnen + + + + ... + + +Das Attribut 'default' kann einmal vergeben werden und +besagt, dass diese Kategorie gewählt werden soll, wenn +keine andere Kategorie zugeordnet werden kann. + +In der Sektion 'patterns' werden dann die Regel +definiert, die einzelne Einträge den definierten Kategorien +zuordnet. Hierfür können zwei Arten von Definitionen +angegeben werden: + + + +oder + + + +Die erste Variante bestimmt die Kategorie, die pro KM-Datei +gelten soll. 'pattern' ist hierbei ein regulärer Ausdruck, +der auf den Dateinamen angewandt wird. Passt der Name +der Datei auf den regulären Ausdruck, wird 'type' als +Vorgabe angenommen. Treffen mehrere -Regeln zu, +wird der erste Treffer angewandt. Findet keine der -Regeln +Anwendung, wird die Kategorie ausgewählt, die in der -Section +das Attribut 'default' gesetzt hat. + +Die zweite Regel-Variante wird auf jeden Eintrag +innerhalb einer KM-Datei auf den Bezeichner der Streckenfavoriten +angewandt. Als Muster dient auch hier ein regulärer Ausdruck, +der über das Attribut 'pattern' definiert wird. Die Kategorie +wird in Trefferfall über das Attribut 'type' bestimmt. Treffen +mehrere Regeln zu, wird die Kategorie gewählt, die zum ersten +Treffer gehört. Trifft keine Regel zu wird der Eintrag der +Kategorie zugeteilt, die für die beinhaltende Datei als Vorgabe +gilt. + +Anhang 'Fehler und Warnungen': +============================= + +Fehler: +------- + +- 'error while parsing gew' + Die GEW-Datei ist fehlerhaft oder konnte nicht geöffnet werden. + +- 'File 'XYZ' is broken!' + Die Datei XYZ ist inkonsistent und führt zu Fehlern. + +- 'Error while parsing file for morph. width.' + Beim Lesen der morphologischen Breite trat ein Fehler auf. + +- 'Error while storing flow velocity model.' + Beim Schreiben eines Fliessgeschwindigkeitsmodells trat ein Fehler auf. + +- 'Error while storing flow velocity measurement.' + Beim Schreiben einer Fliessgeschwindigkeitsmessung trat ein Fehler auf. + +- 'Error while storing sediment yield.' + Beim Schreiben einer Sedimentablagerung trat ein Fehler auf. + +- 'Error while storing waterlevel diff.' + Beim Schreiben einer Wassspiegeldifferenz trat ein Fehler auf. + +- 'Error while storing sq relation.' + Beim Schreiben einer S(Q) Beziehung trat ein Fehler auf. + +- 'Error reading PRF file.' + Beim Lesen einer PRF-Datei trat ein Fehler auf. + +- 'Error closing PRF file.' + Beim Schliessen einer PRF-Datei trat ein Fehler auf. + +- 'HYK 1: not enough elements in line #' +- 'HYK 2: not enough elements in line #' +- 'HYK 5: not enough elements in line #' +- 'HYK 6: not enough elements in line #' + Eine Zeile in einer HYK-Datei hat nicht genügend Elemente. + +- 'HYK: parsing num zones, bottom or top height failed in line #' +- 'HYK: HYK: number of flow zones mismatches in line #' + Die Anzahl der Zonen oder Daten über die Zonen sind nicht korrekt. + +- 'HYK: cannot parse number in line #' + Eine Zahl wurde erwartet. + +- 'HYK: Error reading file.' + Beim Lesen einer HYK-Datei trat ein Fehler auf. + +- 'HYK: Error closing file.' + Beim Schliessen einer HYK-Datei trat ein Fehler auf. + +Warnungen: +---------- + +- 'annotation type file 'XYZ' is not readable.' + Die Datein XYZ kann nicht gelesen werden. + +- 'cannot parse annotation types file.' + Während der Verarbeitung der Annotationsdatei ist Fehler aufgetreten. + +- 'Cannot read directory.' + verzeichnis konnte nicht gelesen werden. + +- 'no official lines wst file found' + Keine Datei mit amtlichen Linien gefunden. + +- 'cannot read fixations wst file directory' + Das Verzeichnis mit den Fixierungen kann nicht gelesen werden. + +- 'cannot read extra longitudinal wst file directory' + Das Verzeichnis mit den zusätzlichen Längsschnitten kann nicht gelesen werden. + +- 'cannot read gauges from 'XYZ'' + Die Pegelgültigkeiten können nicht gelesen werden. + +- 'HYK file 'XYZ' seems to be a duplicate.' + Die HYK-Datei wurde unter anderem Namen aber gleichen Inhalts + bereits gefunden. + +- 'PRF file 'XYZ' seems to be a duplicate.' + Die PRF-Datei wurde unter anderem Namen aber gleichen Inhalts + bereits gefunden. + +- 'Skip invalid SedimentYield: time interval or unit null!' + Eine Sedimentablagerung ist ungültig und wurde ausgelassen. + +- 'skip flow velocity model: No discharge zone specified.' + Da kein Abflussbereich angegeben wurde, wurde das Fliessgeschwindigkeitsmodell ausgelassen. + +- 'skip invalid waterlevel - no unit set!' + Ein einheitenloser Wasserstand wurde ausgelassen. + +- 'Cannot parse time range.' + Das Zeitformat wurde nicht erkannt. + +- 'skip invalid data line #' + Ungültige Datenzeile wurde ausgelassen. + +- 'Error while parsing sq relation row #' + Eine Zeile in der S(Q)-Beziehung ist ungültig. + +- 'GLT: no gauge found in line #' + In der GLT-Datei wurde ein Pegel erwartet, aber nicht gefunden. + +- 'GLT: line # has not enough columns.' + Eine Zeile in der Pegelgültigkeitsdatei hat nicht genug spalten. + +- 'Error while parsing flow velocity values.' +- 'skip invalid data line: #' + Invalide Datenzeile in einer Datei mit einer Fliessgeschwindigkeitsmessung. + +- 'skip invalid waterlevel line: #' +- 'Error while parsing value: #' +- 'Error while parsing station: #' + Invalide Datenzeile in einer Datei mit Wasserstandsdifferenzen. + +- 'skip invalid MainValue part: #' +- 'skip invalid gauge part: #' +- 'Error while parsing Q value: ' +- 'skip invalid data line: #' +- 'Error while parsing flow velocity values.' + Invalide Datenzeile in einer Datei Fliessgeschwindigkeitsmodellen. + +- 'Error while parsing number from data row: #' + TODO INGO + +- 'Unknown meta line: #' +- 'Error while parsing numbers in: #' +- 'skip invalid data line: #' +- 'Error while parsing numbers in #' + Invalide Datenzeile in einer Datei mit Sedimentdichten. + +- 'STA file is empty' +- 'STA file has not enough lines' +- 'STA file is too short' + Stammdatendatei ist leer oder hat zu wenige Zeilen. + +- 'First line in STA file is too short.' + Die erste Zeile der Stammdaten ist zu kurz. + +- 'STA: second line is too short' + Die zweite Zeile ist zu kurz. + +- 'STA: parsing of the datum of the gauge failed' + +- 'STA: 'XYZ' is not a valid long number.' + Die Pegelnummer ist invalide. + +- 'STA: Not enough columns for aeo and datum. + AEO und Pegelnullpunkt können nicht ermittelt werden. + +- 'STA: cannot parse aeo or datum.' + AEO oder Pegelnullpunkt sind invalide. + +- 'STA: value not parseable in line #' + Wert ist nicht als Zahl zu interpretieren. + +- 'PRF: cannot open file ' + Die PRF kann nicht geöffnet werden. + +- PRF: file is empty +- PRF: First line does not look like a PRF data pattern. +- PRF: premature EOF. Expected integer in line 2 +- PRF: Expected in line 2 +- PRF: invalid integer in line 2 +- PRF: premature EOF. Expected pattern for km extraction +- PRF: line 4 does not look like a PRF km extraction pattern. +- PRF: premature EOF. Expected skip row count. +- PRF: line 5 is not an positive integer. +- PRF: cannot extract km in line # + Das PRF-Format ist komplex. Hier sollten weitere Information + zur genaueren Analyse herangezogen werden. + +- 'cannot access WST file ' + Die WST-Datei konnte nicht gefunden werden. + +- 'Found an invalid row in the AT file.' + Eine Zeile in einer AT-Datei ist nicht korrekt. + +- 'AT: invalid number ' + Eine Zahl wurde erwartet aber nicht gefunden. + +- 'Try to add Q range without waterlevel!' + Q-Bereich ohne Wasserstand gefunden. + +- 'Error while parsing Q range: #' + Invalider Q-Bereich + +- 'skip invalid waterlevel line: #' + Ungültige Wasserstandslinie + +- 'Error while parsing number values: #' + Ungültige Zahlenwerte. + +- 'ANN: not enough columns in line #' + Nicht genug Zeichenspalten in KM-Datei + +- 'ANN: invalid number in line #' + Ungültige Zahl. + +- 'ANN: cannot parse 'Unterkante' in line #' + Die Unterkante in einer KM-Datei konnte nicht gelesen werden. + +- 'ANN: cannot parse 'Unterkante' or 'Oberkante' in line #' + Unter- oder Oberkannte liegen in einem falschen Format vor. + +- 'ANN: duplicated annotation 'XYZ' in line #' + Ein Duplikat eines Streckenfavoriten wurde gefunden. + +- 'ANN: 'XYZ' is not a directory.' + Unterverzeichnis konnte nicht geöffnet werden. + +- 'ANN: cannot list directory 'XYZ'' + Unterverzeichnis konnte nicht durchsucht werden. + +- 'BHP: Meta line did not match any known type: #' + Unbekannter Typ. + +- 'BHP: Error while parsing timeinterval!' + Ungültiges Zeitinterval. + +- 'BHP: Error while parsing year!' + Ungültige Jahresangabe. + +- 'BHP: Error while parsing sounding width!' + Unbekannte Peilungsbreite. + +- 'BHP: Error while parsing range!' + Bereichsangabe fehlerhaft. + +- 'MWP: Unknown meta line: #' + Meta-Informationen ungültig. + +- 'MWP: skip invalid data line: #' + Ungültige Datenzeile wurde übersprungen. + +- 'MWP: Error while parsing numbers in #' + Falsche Zahlenformat. + +- 'ANNCLASS: rule has no name' + Klassifizierungsregel für Streckenfavoriten hat keinen Namen. + +- 'ANNCLASS: pattern has no 'pattern' attribute.' + Klassifizierungsmuster für Streckenfavoriten hat kein Muster. + +- 'ANNCLASS: pattern has unknown type 'XYZ'' + Klassifizierungsmuster für Streckenfavoriten konnte keinem Typ zugeordnet werden. + +- 'ANNCLASS: pattern 'XYZ' is invalid.' + Klassifizierungsmuster für Streckenfavoriten ist ungültig. + +- 'BSP: Error while parsing data row.' + Ungültige Datenzeile. + +- 'SYP: Unknown meta line: #' + Ungültige Metadatenzeile. + +- 'SYP: skip invalid data line #' + Ungültige Datenzeile wurde übersprungen. + +- 'SYP: Error while parsing numbers in #' + Ungültige Zahlenformatierung. + +- 'SYP: Unknown time interval string ' + Falsches Datumformat. + +- 'SYP: Error while parsing years ' + Falsches Jahreszahlformat. + +- 'SYP: Error while parsing ranges of ' + Bereichsangaben fehlerhaft. + +- 'SYP: Unknown grain fraction ' + Unbekannte Kornfraktion. + +- 'WST: invalid number.' + Ungültige Zahl. + +- 'WST: km () found more than once. -> ignored.' + Ein Kilometer ist doppelt in einer WST-Datei enthalten. + +- 'HYK: zone coordinates swapped in line #' + Fliesszonenkordinaten wurden in umgekehrter Reihenfolge angeben. + +- 'BHS: Skip invalid file 'XYZ'' + Die Inhalte der Datei sind ungültig. + +- 'ISQ: Unable to store sq relation value.' + S(Q) Beziehung konnte nicht gespeichert werden. + +- 'ISQ: Cannot determine sq relation without time interval.' + Einer S(Q)-Beziehung ist keine zeitliche Gültigkeit zugeordnet. + +- 'IWD: skip invalid waterlevel difference - no unit set!' + Wasserstandsdifferenz hat keine Einheit. + +- 'BHE: Skip file - invalid current elevation model.' + Höhenmodell ungültig. + +- 'BHE: Skip file - invalid time range.' + Zeitbereich ungültig. + +- 'BHE: Skip file - invalid km range.' + Kilometerbereich ungültig. + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/doc/annotation-types.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/doc/annotation-types.xml Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 4adc35aa655c -r 69d19995bc3c flys-backend/doc/documentation/de/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/doc/documentation/de/Makefile Fri Sep 28 12:14:48 2012 +0200 @@ -0,0 +1,3492 @@ +# Copyright 2004 Chris Monson (shiblon@gmail.com) +# Latest version available at http://www.bouncingchairs.net/oss +# +# This file is part of ``Chris Monson's Free Software''. +# +# ``Chris Monson's Free Software'' is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, Version 2. +# +# ``Chris Monson's Free Software'' is distributed in the hope that it will +# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with ``Chris Monson's Free Software''; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# It is also available on the web at http://www.gnu.org/copyleft/gpl.html +# +# Note that using this makefile to build your documents does NOT place them +# under the GPL unless you, the author, specifically do so. In other words, +# I, Chris Monson, the copyright holder and author of this makefile, +# consider it impossible to ``link'' to this makefile in any way covered by +# the GPL. +# +# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN: +# make help +# +fileinfo := LaTeX Makefile +author := Chris Monson +version := 2.2.0-rc1 +# +# Note that the user-global version is imported *after* the source directory, +# so that you can use stuff like ?= to get proper override behavior. +.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini +-include Makefile.ini +-include $(HOME)/.latex-makefile/Makefile.ini +# +# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini: +# BUILD_STRATEGY := latex +BUILD_STRATEGY ?= pdflatex +# +# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be +# # immune to changes to the locale in the user environment. +export LC_ALL ?= C +# +# +# If you specify sources here, all other files with the same suffix +# will be treated as if they were _include_ files. +#onlysources.tex ?= main.tex +#onlysources.tex.sh ?= +#onlysources.tex.pl ?= +#onlysources.tex.py ?= +#onlysources.rst ?= +#onlysources.fig ?= +#onlysources.gpi ?= +#onlysources.dot ?= +#onlysources.xvg ?= +#onlysources.svg ?= +#onlysources.eps.gz ?= +#onlysources.eps ?= +# +# If you list files here, they will be treated as _include_ files +#includes.tex ?= file1.tex file2.tex +#includes.tex.sh ?= +#includes.tex.pl ?= +#includes.tex.py ?= +#includes.rst ?= +#includes.fig ?= +#includes.gpi ?= +#includes.dot ?= +#includes.xvg ?= +#includes.svg ?= +#includes.eps.gz ?= +#includes.eps ?= +# +# If you list files or wildcards here, they will *not* be cleaned - default is +# to allow everything to be cleaned. +#neverclean ?= *.pdf +# +# Alternatively (recommended), you can add those lines to a Makefile.ini file +# and it will get picked up automatically without your having to edit this +# Makefile. +# +# KNOWN ISSUES: +# * The following occurs: +# file with: \usepackage{named}\bibliographystyle{named} +# Compile +# change to: \usepackage{apalike}\bibliographystyle{apalike} +# Compile again -- BARF! +# +# The workaround: make clean-nographics; make +# +# Note that we may not be able to fix this. LaTeX itself barfs +# on this, not the makefile. The very first invocation of LaTeX +# (when something like this has happened) reads the existing .aux +# file and discovers invalid commands like \citeauthoryear that +# are only valid in the package that was just removed. It then +# tries to parse them and explodes. It's not at all clear to me +# how to fix this. I tried removing the .aux files on the first +# run of LaTeX, but that necessarily requires more subsequent +# rebuilds on common edits. There does not appear to be a +# graceful solution to this issue. +# +# CHANGES: +# Chris Monson (2010-04-08): +# * Bumped version to 2.2.0-rc1 +# * Added back in the rst_style_file stuff that got broken when switching +# rst -> tex to use the script mechanism +# Chris Monson (2010-03-23): +# * Bumped version to 2.2.0-beta8 +# * Work on issue 76: bad backtick escape for some sed versions, failure +# to clear out the hold buffer when outputting MISSING comment. +# - Backed out 2>&1 to &> (doesn't work in sh) +# - Backed out using . to source variables +# Chris Monson (2010-03-22): +# * Bumped version to 2.2.0-beta7 +# * Issue 72: Fix latex/bibtex invocation order for annotated bib styles +# * Fixed informational output to reflect which LaTeX run we're on +# * Fixed graphic detection to include graphics that are already there in +# .d files +# * Tightened up the .d file output to only make .d depend on graphic +# *source* files. This means that building foo.d no longer +# builds all of the graphics files on which foo.tex depends. +# Had to use .SECONDEXPANSION trickery to make it work. +# * Changed get-graphics to only accept a stem. +# * Fixed build-once logic for scripted .tex to work better +# * Made get-inputs sed script more maintainable. +# * Moved Makefile.ini import up higher. +# * Changed bare stems to not recursively invoke make +# * Updated diff output to be more silent everywhere +# * Added a MISSING comment to the .d file if stuff isn't found - forces +# removal of .1st.make file, which often forces it to try again. +# * Fixed broken graphics-target function +# * Added sleep to .d file generation when stuff is missing - if it +# builds too fast, make doesn't realize it needs to be reloaded, +# and thus never discovers some deeper dependencies (especially +# evident when graphics are included from scripted include +# files). +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta6 +# * Fixed bareword builds to actually work (requires static patterns) +# * Fixed colorization to work with new paragraph stuff +# Chris Monson (2010-03-17): +# * Bumped version to 2.2.0-beta5 +# * Fixed graphic detection to be much more focused - splits log file +# into paragraphs before doing pattern matching. +# * Fixed make foo to work properly (recursively calls make foo.pdf) +# * Fixed gpi -> pdf generation to not waste time building .eps *after* +# the pdf already exists. +# * Changed log copies to include MAKE_RESTARTS as part of the name. +# * Fixed missing include file detection (also makes use of the paragraph +# stuff) to detect missing scripted include files. +# Chris Monson (2010-03-16): +# * Bumped version to 2.2.0-beta4 +# * issue 70: .pdf not moved out of the way properly on first +# compilation, resulting in early error detection failure. +# * issue 74: fixed broken error on missing .aux files: the +# implementation was masking real errors. +# Chris Monson (2010-03-15): +# * Bumped version to 2.2.0-beta3 +# * issue 71: Made the tput dependency optional +# * issue 73: Made .tex targets not pull in .d files (building them from +# scripts should not require a .d) +# * issue 74: Output a much saner error when a .aux file is not produced +# (e.g., when you are typing "make" without arguments in a +# directory with included .tex files that are not named with +# ._include_.) +# Chris Monson (2010-03-11): +# * Bumped version to 2.2.0-beta2 +# * Fixed clean-graphics to get rid of intermediate .eps files that may +# be hanging around +# * Added an automatic setting to use eps terminals in pdflatex mode for +# gnuplot if it doesn't understand pdf. +# * issue 66: Removed grayscale generation via magic suffix. Grayscale +# generation is now only available via GRAY=1 +# * issue 68: Added explicit handling of LC_ALL for locale-aware tools +# like "sort" +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-beta1 +# * Fixed success message to handle output message in different places +# * Added name of produced file to success message +# Chris Monson (2010-03-10): +# * Bumped version to 2.2.0-alpha3 +# * Added meaningful error message for wrong hyperref options +# * Added meaningful error message for incorrect graphics extensions +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha2 +# * Updated graphics handling (gnuplot and fig generate pdf natively) +# * Changed xmgrace to output monochrome natively +# Chris Monson (2010-03-09): +# * Bumped version to 2.2.0-alpha1 - major change! +# * Support pdflatex natively and by default (issue 6 - a long time coming) +# * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for +# all invocations +# * Reworked graphic inclusion detection so that extensions need not be +# specified for either build strategy (e.g., +# \includegraphics{test1.eps} -> \includegrahpics{test1}) +# * Changed log format to include filenames and line numbers +# Chris Monson (2010-02-04): +# * Bumped version to 2.1.43 +# * All of the following are for issue 63 (thanks to mojoh81): +# * Added documentation about fixing Makefile.ini default target +# * Added perl and python script targets +# * Fixed run logic to allow included .tex files to be scripted (the +# run-again logic now detects missing .tex files, and the MV +# command has been switched out for a command that only invokes +# MV if the files exist) +# * Changed scripted generation to only run once per make invocation +# * Added dependency on expr +# Chris Monson (2010-01-19): +# * Bumped version to 2.1.42 +# * issue 62: Added .brf extension to cleanable files (backrefs) +# Chris Monson (2010-01-07): +# * Bumped version to 2.1.41 +# * issue 60: bad makeindex runs now error out on subsequent tries +# Chris Monson (2009-12-01): +# * Bumped version to 2.1.40 +# * issue 36: build all indices (for e.g., splitidx usage) +# * issue 59: clean up all generated files (including indices) +# Chris Monson (2009-11-23): +# * Bumped version to 2.1.39 +# * issue 57: change ps2pdf invocations to just use gs directly +# Chris Monson (2009-11-19): +# * Bumped version to 2.1.38 +# * issue 57: Added some limited support for Cygwin (spaces in filenames) +# Chris Monson (2009-11-15): +# * Bumped version to 2.1.37 +# * Removed svninfo, since this is now managed by mercurial +# * Fixed typo in changelist +# * Issue 52: added jpg->eps conversion (thanks to brubakee) +# * Issue 54: fix missing Overfull colorization due to lack of a blank +# line preceding the first error. +# * Issue 51: remove head.tmp and body.tmp in make clean invocation +# * Issue 56: maintain multiple versions of log files (for debugging) +# Chris Monson (2009-11-14): +# * Bumped version to 2.1.36 +# * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables +# Chris Monson (2009-11-05): +# * Bumped version to 2.1.35 +# * Added nomenclature support (see issue 48) +# Chris Monson (2009-10-29): +# * Bumped version to 2.1.34 +# * Fixed _out_ creation bug introduced in 2.1.33 (it was always created) +# * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR +# * Changed contact email address - bring on the spam! +# Chris Monson (2009-10-21): +# * Bumped version to 2.1.33 +# * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay) +# * Made all_files.* settable in Makefile.ini (using ?= instead of :=) +# * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy +# dvi, pdf, and ps if it exists +# Chris Monson (2009-09-25): +# * Bumped version to 2.1.32 +# * Fixed so that a changed lol file will cause a rebuild +# * Added .lol files to the cleanable list +# Chris Monson (2009-09-08): +# * Bumped version to 2.1.31 +# * Closed issue 43: evince doesn't notice pdf change w/out touch +# Chris Monson (2009-08-28): +# * Bumped version to 2.1.30 +# * Closed issue 39: Capture multi-line log warnings/errors to output +# Chris Monson (2009-08-26): +# * Bumped version to 2.1.29 +# * Closed issue 42: add svg support using inkscape +# Chris Monson (2009-08-17): +# * Bumped version to 2.1.28 +# * Patch from paul.biggar for issue 38: package warnings are overlooked +# Chris Monson (2009-08-07): +# * Bumped version to 2.1.27 +# * Included patch for issue 37 - removes pdf/ps files before copying, +# allowing some broken viewers to see changes properly. +# Chris Monson (2009-05-15): +# * Bumped version to 2.1.26 +# * Included patch for issue 9 from favonia - detects .fig changes for +# pstex files during regular compilation, so long as the pstex +# has been built at least once with make all-pstex. +# Chris Monson (2009-03-27): +# * Bumped version to 2.1.25 +# * Cleaned up a bunch of variable setting stuff - more stuff is now +# settable from Makefile.ini +# * Cleaned up documentation for various features, especially settable +# variables. +# * issue 28: support for png -> eps conversion (it even looks good!) +# * issue 29: support for "neverclean" files in Makefile.ini +# * issue 30: make ps2pdf14 the default - fall back when not there +# Chris Monson (2009-03-09): +# * Bumped version to 2.1.24 +# * issue 27: xmgrace support (thanks to rolandschulzhd) +# Chris Monson (2008-10-23): +# * Bumped version to 2.1.23 +# * issue 23: fixed _check_programs to not use bash string subs +# Chris Monson (2008-09-02): +# * Bumped version to 2.1.22 +# * Appled patch from Holger to add include +# sources and some documentation updates. +# * Updated backup_patterns to be a bit more aggressive (also thanks to +# Holger) +# Chris Monson (2008-08-30): +# * Bumped version to 2.1.21 +# * Added ability to specify onlysources.* variables to indicate the only +# files that should *not* be considered includes. Thanks to Holger +# for this patch. +# * Added an automatic include of Makefile.ini if it exists. Allows +# settings to be made outside of this makefile. +# Chris Monson (2008-05-21): +# * Bumped version to 2.1.20 +# * Added manual pstex compilation support (run make all-pstex first) +# * Removed all automatic pstex support. It was totally breaking +# everything and is very hard to incorporate into the makefile +# concept because it requires LaTeX to *fail* before it can +# determine that it needs the files. +# Chris Monson (2008-04-17): +# * Bumped version to 2.1.19 +# * Changed the pstex build hack to be on by default +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.18 +# * issue 16: fixed pstex build problems, seems nondeterministic. Added +# gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1. +# Chris Monson (2008-04-09): +# * Bumped version to 2.1.17 +# * issue 20: fixed accumulation of *.make files - wildcard was +# refusing to work on files that are very recently created. +# Chris Monson (2008-04-02): +# * Bumped version to 2.1.16 +# * issue 19: Removed the use of "type" to fix broken "echo" settings +# Chris Monson (2008-03-27): +# * Bumped version to 2.1.15 +# * issue 18: Favors binary echo over builtin, as binary understands -n +# * issue 16: Fixed handling of missing pstex_t files in the log +# * issue 9: Added .SECONDARY target for .pstex files +# Chris Monson (2008-03-21): +# * Bumped version to 2.1.14 +# * Fixed broken aux file flattening, which caused included bibs to be +# missed. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.13 +# * Changed error output colorization to show errors for missing files +# that are not graphics files. +# Chris Monson (2008-03-20): +# * Bumped version to 2.1.12 +# * Fixed a regression introduced in r28 that makes bibtex fail when +# there is no index file present +# Chris Monson (2008-03-03): +# * Bumped version to 2.1.11 +# * Fixed issue 11 (handle index files, reported by abachn) +# * Cleaned up some comments and help text +# Chris Monson (2008-01-24): +# * Bumped version to 2.1.10 +# * Fixed to work when 'sh' is a POSIX shell like 'dash' +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.9 +# * Fixed documentation and dependency graph for pstex files +# Chris Monson (2007-12-12): +# * Bumped version to 2.1.8 +# * Added basic pstex_t support for fig files (Issue 9 by favonia) +# I still suggest that psfrag be used instead. +# Chris Monson (2007-10-16): +# * Bumped version to 2.1.7 +# * Removed todo item: allow other comment directives for rst conversion +# * Added ability to use global rst style file _rststyle_._include_.tex +# * Added help text to that effect +# Chris Monson (2007-05-20): +# * Bumped version to 2.1.6 +# * Changed default paper size for rst files +# * Added todo item: fix paper size for rst files +# * Added todo item: allow other comment directives for rst conversion +# Chris Monson (2007-04-02): +# * Bumped version to 2.1.5 +# * Addressed Issue 7, incorrect .gpi.d generation in subdirectories +# Chris Monson (2007-03-28): +# * Bumped version to 2.1.4 +# * Fixed syntax error in dot output +# Chris Monson (2007-03-01): +# * Bumped version to 2.1.3 +# * Added reST to the included documentation +# * Fixed graphics and script generation to be settable in the +# environment. +# Chris Monson (2007-02-23): +# * Bumped version to 2.1.2 +# * Added the ability to generate .tex files from .rst files +# Chris Monson (2006-10-17): +# * Bumped version to 2.1.1 +# * Fixed includes from subdirectories (sed-to-sed slash escape problem) +# Chris Monson (2006-10-05): +# * Bumped version to 2.1.0 (pretty serious new feature added) +# * New feature: bib files can now be anywhere on the BIBINPUTS path +# * New programs: kpsewhich (with tetex) and xargs (BSD) +# Chris Monson (2006-09-28): +# * Bumped version to 2.0.9 +# * Added ability to parse more than one bibliography +# Chris Monson (2006-06-01): +# * Bumped version to 2.0.8 +# * Added .vrb to the list of cleaned files +# Chris Monson (2006-04-26): +# * Bumped version to 2.0.7 +# * Fixed so that clean-nographics does not remove .gpi.d files +# * Removed jpg -> eps hack (not working properly -- just pre-convert) +# * Fixed so that postscript grayscale can be done with BSD sed +# Chris Monson (2006-04-25): +# * Bumped version to 2.0.6 +# * Fixed so that changed toc, lot, lof, or out causes a rebuild +# Chris Monson (2006-04-17): +# * Bumped version to 2.0.5 +# * Added jpg -> eps conversion target +# Chris Monson (2006-04-12): +# * Bumped version to 2.0.4 +# * Fixed BSD sed invocation to not use \| as a branch delimiter +# * Added a comment section on what is and is not allowed in BSD sed +# * Made paper size handling more robust while I was at it +# * Fixed postscript RGB grayscale to use a weighted average +# * Fixed postscript HSB grayscale to convert to RGB first +# * Fixed a problem with rebuilding .bbl files +# Chris Monson (2006-04-11): +# * Bumped version to 2.0.3 +# * Fixed some BSD sed problems: can't use \n in substitutions +# Chris Monson (2006-04-10): +# * Bumped version to 2.0.2 +# * Once again removed ability to create .tex files from scripts +# * \includeonly works again +# Chris Monson (2006-04-09): +# * Bumped version to 2.0.1 +# * Fixed grayscale postscript handling to be more robust +# * Added ability to generate ._gray_. files from eps and eps.gz +# * Added ability to clean ._gray_.eps files created from .eps files +# Chris Monson (2006-04-07): +# * Bumped version to 2.0.0 +# * Removed clunky ability to create included .tex files from scripts +# * Added note in the help about included tex scripting not working +# * Fixed the .eps generation to delete %.gpihead.make when finished +# * Abandoned designs to use shell variables to create sed scripts +# * Abandoned __default__.tex.sh idea: it causes recursion with %: . +# * Removed web page to-do. All items are now complete. +# * Added better grayscale conversion for dot figures (direct ps fixup). +# * Include files can now be scripted (at the expense of \includeonly). +# * Updated dependency graph to contain better node names. +# Chris Monson (2006-04-06): +# * Bumped version to 2.0b3 +# * Top level includes now fail if there is no rule to build them +# * A helpful message is printed when they do fail +# * Grayscale has been changed to be ._gray_, other phonies use _ now, too +# * Grayscale handling has been completed +# * Changed _include_stems target to _includes target. +# * Fixed _includes target to be useful by itself. +# * Removed the ability to specify clean and build targets at once +# * Verified that epsfig works fine with current code +# * Fixed included scripts so that they are added to the dep files +# * Fixed so that graphics includes don't happen if they aren't for gpi +# * Fixed dot output to allow grayscale. +# Chris Monson (2006-04-05): +# * Bumped version to 2.0b2 +# * Removed automatic -gray output. It needs fixing in a bad way. +# * Revamped dependency creation completely. +# * Fixed conditional inclusion to actually work (test.nobuild.d, test.d). +# * Fixed clean target to remove log targets +# * Added the 'monochrome' word for gray gpi output +# * Added a _check_gpi_files target that checks for common problems +# * Changed the _version target into the version target (no _) +# * Added better handling of grayscale files. Use the .gray.pdf target. +# * Fixed testing for rebuilds +# Chris Monson (2006-04-04): +# * Bumped version to 2.0b1 +# * Changed colorization of output +# * Made .auxbbl and .auxtex .make files secondary targets +# * Shortened and simplified the final latex invocation loop +# * Added version-specific output ($$i vs. $$$$i) in latex loop +# * Added a build message for the first .dvi run (Building .dvi (0)) +# * Removed some build messages that most people don't care about. +# * Simplified procedure for user-set colors -- simple text specification +# * Fixed diff output to...not output. +# * Fixed rerun bug -- detect not only when preceded with LaTeX Warning +# * Sped up gpi plotting +# * Added error handling and colorized output for gpi failure +# * Documented color changing stuff. +# * Now sort the flattened aux file to avoid false recompilation needs +# * Added clean-nographics target +# * Don't remove self.dvi file if self.aux is missing in the log +# * Clarified some code. Did some very minor adjusting. +# Chris Monson (2006-04-03): +# * Bumped version to 2.0a7 +# * Added .dvi and .ps files as secondary files. +# * Fixed handling of multiple run detection when includeonly is in use. +# * Added code to flatten .aux files. +# * Added more files as .SECONDARY prerequisites to avoid recompilation. +# * Fixed the inputs generation to be much simpler and to use pipes. +# * Added the dependency graph directly into the makefile. +# * Changed flatten-aux to remove \@writefile \relax \newlabel, etc. +# * Undid pipe changes with sed usage (BSD sed doesn't know -f-). +# * Added a _check_programs target that tells you what your system has. +# * Fixed an error in colorization that made unnecessary errors appear +# * Added view targets. +# * Updated help text. +# * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds +# * Added more informative error handling for dvips and ps2pdf +# Chris Monson (2006-04-02): +# * Bumped version to 2.0a6 +# * Added indirection to .bbl dependencies to avoid rebuilding .bbl files +# * Streamlined the diff invocation to eliminate an existence test +# * Removed special shell quote escape variables +# * Moved includes to a more prominent location +# * Fixed .inputs.make to not contain .aux files +# * Fixed embedding to use a file instead of always grepping. +# * Added *.make.temp to the list of cleanable files +# * Fixed Ruby. It should now be supported properly. +# * Now differentiate between all, default, and buildable files. +# * Fixed to bail out on serious errors. +# * Revised the handling of includable files. Still working on it. +# Chris Monson (2006-03-31): +# * Bumped version to 2.0a5 +# * Fixed a bug with LaTeX error detection (there can be spaces) +# * Added .bbl support, simplifying everything and making it more correct +# * Refactored some tests that muddy the code +# * Did a little cleanup of some shell loops that can safely be make loops +# * Added support for graphviz .dot files +# * Made _all_programs output easier to read +# * Added the ruby support that has long been advertised +# * Font embedding was screwed up for PostScript -- now implicit +# * Changed the generation of -gray.gpi files to a single command +# * Changed any make-generated file that is not included from .d to .make +# Chris Monson (2006-03-30): +# * Bumped version to 2.0a4 +# * Fixed a bug with very long graphics file names +# * Added a todo entry for epsfig support +# * Fixed a bug paper size bug: sometimes more than one entry appears +# * Fixed DVI build echoing to display the number instead of process ID +# * DVI files are now removed on first invocation if ANY file is missing +# * Added a simple grayscale approach: if a file ends with -gray.gpi, it +# is created from the corresponding .gpi file with a special +# comment ##GRAY in its header, which causes coloring to be +# turned off. +# * Fixed a bug in the handling of .tex.sh files. For some reason I had +# neglected to define file stems for scripted output. +# * Removed a trailing ; from the %.graphics dependencies +# * Added dvips embedding (I think it works, anyway) +# Chris Monson (2006-03-29): +# * Bumped version to 2.0a3 +# * Fixed error in make 3.79 with MAKEFILE_LIST usage +# * Added the presumed filename to the _version output +# * Added a vim macro for converting sed scripts to make commands +# * Added gpi dependency support (plotting external files and loading gpi) +# * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi +# * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}. +# Chris Monson (2006-03-28): +# * Bumped version to 2.0a2 +# * Added SHELL_DEBUG and VERBOSE options +# * Changed the default shell back to /bin/sh (unset, in other words) +# * Moved .PHONY declarations closer to their targets +# * Moved help text into its own define block to obtain better formatting +# * Removed need for double-entry when adding a new program invocation +# * Moved .SECONDARY declaration closer to its relevant occurrence +# * Commented things more heavily +# * Added help text about setting terminal and output in gnuplot +# * Created more fine-grained clean targets +# * Added a %.graphics target that generates all of %'s graphics +# * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps) +# * For now, we're just GPL 2, not 3. Maybe it will change later +# * Made the version and svninfo into variables +# Chris Monson (2006-03-27): +# * Bumped version to 2.0a1 +# * Huge, sweeping changes -- automatic dependencies + +# IMPORTANT! +# +# When adding to the following list, do not introduce any blank lines. The +# list is extracted for documentation using sed and is terminated by a blank +# line. +# +# EXTERNAL PROGRAMS: +# = ESSENTIAL PROGRAMS = +# == Basic Shell Utilities == +CAT ?= cat +CP ?= cp -f +DIFF ?= diff +ECHO ?= echo +EGREP ?= egrep +ENV ?= env +EXPR ?= expr +MV ?= mv -f +SED ?= sed +SORT ?= sort +TOUCH ?= touch +UNIQ ?= uniq +WHICH ?= which +XARGS ?= xargs +SLEEP ?= sleep +# == LaTeX (tetex-provided) == +BIBTEX ?= bibtex +DVIPS ?= dvips +LATEX ?= latex +PDFLATEX ?= pdflatex +EPSTOPDF ?= epstopdf +MAKEINDEX ?= makeindex +KPSEWHICH ?= kpsewhich +GS ?= gs +# = OPTIONAL PROGRAMS = +# == Makefile Color Output == +TPUT ?= tput +# == TeX Generation == +PERL ?= perl +PYTHON ?= python +RST2LATEX ?= rst2latex.py +# == EPS Generation == +CONVERT ?= convert # ImageMagick +DOT ?= dot # GraphViz +DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed +FIG2DEV ?= fig2dev # XFig +GNUPLOT ?= gnuplot # GNUplot +INKSCAPE ?= inkscape # Inkscape (svg support) +XMGRACE ?= xmgrace # XMgrace +PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps +PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps +PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps +GUNZIP ?= gunzip # GZipped EPS +# == Beamer Enlarged Output == +PSNUP ?= psnup +# == Viewing Stuff == +VIEW_POSTSCRIPT ?= gv +VIEW_PDF ?= xpdf +VIEW_GRAPHICS ?= display + +# Command options for embedding fonts and postscript->pdf conversion +PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100 +PS_COMPATIBILITY ?= 1.4 + +# Defaults for GPI +DEFAULT_GPI_EPS_FONTSIZE ?= 22 +DEFAULT_GPI_PDF_FONTSIZE ?= 12 + +# Style file for ReST +RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex) + +# This ensures that even when echo is a shell builtin, we still use the binary +# (the builtin doesn't always understand -n) +FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO)) +ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO)) + +define determine-gnuplot-output-extension +$(if $(shell $(WHICH) $(GNUPLOT)), + $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)), + eps, pdf), + none) +endef + +GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension)) + +# Directory into which we place "binaries" if it exists. +# Note that this can be changed on the commandline or in Makefile.ini: +# +# Command line: +# make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf +# +# Also, you can specify a relative directory (relative to the Makefile): +# make BINARY_TARGET_DIR=pdfs myfile.pdf +# +# Or, you can use Makefile.ini: +# +# BINARY_TARGET_DIR := $(HOME)/bin_out +# +BINARY_TARGET_DIR ?= _out_ + +RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0) +# SH NOTES +# +# On some systems, /bin/sh, which is the default shell, is not linked to +# /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it +# just isn't. This section details some of the things you have to stay away +# from to remain sh-compatible. +# +# * File pattern expansion does not work for {} +# * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ] +# * &> for stderr redirection doesn't work, use 2>&1 instead +# +# BSD SED NOTES +# +# BSD SED is not very nice compared to GNU sed, but it is the most +# commonly-invoked sed on Macs (being based on BSD), so we have to cater to +# it or require people to install GNU sed. It seems like the GNU +# requirement isn't too bad since this makefile is really a GNU makefile, +# but apparently GNU sed is much less common than GNU make in general, so +# I'm supporting it here. +# +# Sad experience has taught me the following about BSD sed: +# +# * \+ is not understood to mean \{1,\} +# * \| is meaningless (does not branch) +# * \n cannot be used as a substitution character +# * ? does not mean \{0,1\}, but is literal +# * a\ works, but only reliably for a single line if subsequent lines +# have forward slashes in them (as is the case in postscript) +# +# For more info (on the Mac) you can consult +# +# man -M /usr/share/man re_format +# +# And look for the word "Obsolete" near the bottom. + +# +# EXTERNAL PROGRAM DOCUMENTATION SCRIPT +# + +# $(call output-all-programs,[]) +define output-all-programs + [ -f '$(this_file)' ] && \ + $(SED) \ + -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \ + -e '/EXTERNAL PROGRAMS/d' \ + -e '/^$$/d' \ + -e '/^[[:space:]]*#/i\ '\ + -e 's/^[[:space:]]*#[[:space:]][^=]*//' \ + $(this_file) $(if $1,> '$1',) || \ + $(ECHO) "Cannot determine the name of this makefile." +endef + +# If they misspell gray, it should still work. +GRAY ?= $(call get-default,$(GREY),) + +# +# Utility Functions and Definitions +# + +# While not exactly a make function, this vim macro is useful. It takes a +# verbatim sed script and converts each line to something suitable in a command +# context. Just paste the script's contents into the editor, yank this into a +# register (starting at '0') and run the macro once for each line of the +# original script: +# +# 0i -e :s/\$/$$/eg :s/'/'"'"'/eg ^Ela'A' \:noh j + +# don't call this directly - it is here to avoid calling wildcard more than +# once in remove-files. +remove-files-helper = $(if $1,$(RM) $1,$(sh_true)) + +# $(call remove-files,file1 file2) +remove-files = $(call remove-files-helper,$(wildcard $1)) + +# Removes all cleanable files in the given list +# $(call clean-files,file1 file2 file3 ...) +# Works exactly like remove-files, but filters out files in $(neverclean) +clean-files = \ + $(call remove-files-helper,$(call cleanable-files,$(wildcard $1))) + +# Outputs all generated files to STDOUT, along with some others that are +# created by these (e.g., .idx files end up producing .ilg and .ind files). +# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind +# filenames as needed. +# +# $(call get-generated-names,) +define get-generated-names +[ -f '$1' ] && \ +$(SED) \ + -e '/^OUTPUT /{' \ + -e ' s///' \ + -e ' p' \ + -e ' s/\.idx/\.ind/p' \ + -e ' s/\.ind/\.ilg/p' \ + -e '}' \ + -e 'd' \ + '$1' \ +| $(SORT) | $(UNIQ) +endef + +# This removes files without checking whether they are there or not. This +# sometimes has to be used when the file is created by a series of shell +# commands, but there ends up being a race condition: make doesn't know about +# the file generation as quickly as the system does, so $(wildcard ...) doesn't +# work right. Blech. +# $(call remove-temporary-files,filenames) +remove-temporary-files = $(if $1,$(RM) $1,:) + +# Create an identifier from a file name +# $(call cleanse-filename,filename) +cleanse-filename = $(subst .,_,$(subst /,__,$1)) + +# Escape dots +# $(call escape-dots,str) +escape-dots = $(subst .,\\.,$1) + +# Test that a file exists +# $(call test-exists,file) +test-exists = [ -e '$1' ] + +# $(call move-files,source,destination) +move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2' + +# Copy file1 to file2 only if file2 doesn't exist or they are different +# $(call copy-if-different,sfile,dfile) +copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2' +copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2' +move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2' +replace-if-different-and-remove = \ + $(call test-different,$1,$2) \ + && $(MV) '$1' '$2' \ + || $(call remove-files,'$1') + +# Note that $(DIFF) returns success when the files are the SAME.... +# $(call test-different,sfile,dfile) +test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1 +test-exists-and-different = \ + $(call test-exists,$2) && $(call test-different,$1,$2) + +# Return value 1, or value 2 if value 1 is empty +# $(call get-default,,) +get-default = $(if $1,$1,$2) + +# Copy a file and log what's going on +# $(call copy-with-logging,,) +define copy-with-logging +if [ -d '$2/' ]; then \ + if $(CP) '$1' '$2/'; then \ + $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \ + else \ + $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \ + fi; \ +fi +endef + +# Gives a reassuring message about the failure to find include files +# $(call include-message,) +define include-message +$(strip \ +$(if $(filter-out $(wildcard $1),$1),\ + $(shell $(ECHO) \ + "$(C_INFO)NOTE: You may ignore warnings about the"\ + "following files:" >&2;\ + $(ECHO) >&2; \ + $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\ + $(ECHO) "$(C_RESET)" >&2) +)) +endef +# Characters that are hard to specify in certain places +space := $(empty) $(empty) +colon := \: +comma := , + +# Useful shell definitions +sh_true := : +sh_false := ! : + +# Clear out the standard interfering make suffixes +.SUFFIXES: + +# Turn off forceful rm (RM is usually mapped to rm -f) +ifdef SAFE_RM +RM := rm +endif + +# Turn command echoing back on with VERBOSE=1 +ifndef VERBOSE +QUIET := @ +endif + +# Turn on shell debugging with SHELL_DEBUG=1 +# (EVERYTHING is echoed, even $(shell ...) invocations) +ifdef SHELL_DEBUG +SHELL += -x +endif + +# Get the name of this makefile (always right in 3.80, often right in 3.79) +# This is only really used for documentation, so it isn't too serious. +ifdef MAKEFILE_LIST +this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) +else +this_file := $(wildcard GNUmakefile makefile Makefile) +endif + +# Terminal color definitions + +REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT))) + +# $(call get-term-code,codeinfo) +# e.g., +# $(call get-term-code,setaf 0) +get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),) + +black := $(call get-term-code,setaf 0) +red := $(call get-term-code,setaf 1) +green := $(call get-term-code,setaf 2) +yellow := $(call get-term-code,setaf 3) +blue := $(call get-term-code,setaf 4) +magenta := $(call get-term-code,setaf 5) +cyan := $(call get-term-code,setaf 6) +white := $(call get-term-code,setaf 7) +bold := $(call get-term-code,bold) +uline := $(call get-term-code,smul) +reset := $(call get-term-code,sgr0) + +# +# User-settable definitions +# +LATEX_COLOR_WARNING ?= magenta +LATEX_COLOR_ERROR ?= red +LATEX_COLOR_INFO ?= green +LATEX_COLOR_UNDERFULL ?= magenta +LATEX_COLOR_OVERFULL ?= red bold +LATEX_COLOR_PAGES ?= bold +LATEX_COLOR_BUILD ?= cyan +LATEX_COLOR_GRAPHIC ?= yellow +LATEX_COLOR_DEP ?= green +LATEX_COLOR_SUCCESS ?= green bold +LATEX_COLOR_FAILURE ?= red bold + +# Gets the real color from a simple textual definition like those above +# $(call get-color,ALL_CAPS_COLOR_NAME) +# e.g., $(call get-color,WARNING) +get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c))) + +# +# STANDARD COLORS +# +C_WARNING := $(call get-color,WARNING) +C_ERROR := $(call get-color,ERROR) +C_INFO := $(call get-color,INFO) +C_UNDERFULL := $(call get-color,UNDERFULL) +C_OVERFULL := $(call get-color,OVERFULL) +C_PAGES := $(call get-color,PAGES) +C_BUILD := $(call get-color,BUILD) +C_GRAPHIC := $(call get-color,GRAPHIC) +C_DEP := $(call get-color,DEP) +C_SUCCESS := $(call get-color,SUCCESS) +C_FAILURE := $(call get-color,FAILURE) +C_RESET := $(reset) + +# +# PRE-BUILD TESTS +# + +# Check that clean targets are not combined with other targets (weird things +# happen, and it's not easy to fix them) +hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1) +hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1) +ifneq "$(hasbuildgoals)" "" +ifneq "$(hascleangoals)" "" +$(error $(C_ERROR)Clean and build targets specified together$(C_RESET))) +endif +endif + +# +# VARIABLE DECLARATIONS +# + +# Names of sed scripts that morph gnuplot files -- only the first found is used +GNUPLOT_SED := global-gpi.sed gnuplot.sed +GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_graphic_extension ?= eps +latex_build_program ?= $(LATEX) +build_target_extension ?= dvi +hyperref_driver_pattern ?= hdvips +hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options. +else +default_graphic_extension ?= pdf +latex_build_program ?= $(PDFLATEX) +build_target_extension ?= pdf +hyperref_driver_pattern ?= hpdf.* +hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). +endif + +# Files of interest +all_files.tex ?= $(wildcard *.tex) +all_files.tex.sh ?= $(wildcard *.tex.sh) +all_files.tex.pl ?= $(wildcard *.tex.pl) +all_files.tex.py ?= $(wildcard *.tex.py) +all_files.rst ?= $(wildcard *.rst) +all_files.fig ?= $(wildcard *.fig) +all_files.gpi ?= $(wildcard *.gpi) +all_files.dot ?= $(wildcard *.dot) +all_files.xvg ?= $(wildcard *.xvg) +all_files.svg ?= $(wildcard *.svg) +all_files.png ?= $(wildcard *.png) +all_files.jpg ?= $(wildcard *.jpg) +all_files.eps.gz ?= $(wildcard *.eps.gz) +all_files.eps ?= $(wildcard *.eps) + +# Utility function for obtaining all files not specified in $(neverclean) +# $(call cleanable-files,file1 file2 file3 ...) +# Returns the list of files that is not in $(wildcard $(neverclean)) +cleanable-files = $(filter-out $(wildcard $(neverclean)), $1) + +# Utility function for getting all .$1 files that are to be ignored +# * files listed in $(includes.$1) +# * files not listed in $(onlysources.$1) if it is defined +ignore_files = \ + $(includes.$1) \ + $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1))) + +# Patterns to never be allowed as source targets +ignore_patterns := %._include_ + +# Patterns allowed as source targets but not included in 'all' builds +nodefault_patterns := %._nobuild_ $(ignore_patterns) + +# Utility function for getting targets suitable building +# $(call filter-buildable,suffix) +filter-buildable = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1)) + +# Utility function for getting targets suitable for 'all' builds +# $(call filter-default,suffix) +filter-default = \ + $(filter-out $(call ignore_files,$1) \ + $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1)) + +# Top level sources that can be built even when they are not by default +files.tex := $(call filter-buildable,tex) +files.tex.sh := $(call filter-buildable,tex.sh) +files.tex.pl := $(call filter-buildable,tex.pl) +files.tex.py := $(call filter-buildable,tex.py) +files.rst := $(call filter-buildable,rst) +files.gpi := $(call filter-buildable,gpi) +files.dot := $(call filter-buildable,dot) +files.fig := $(call filter-buildable,fig) +files.xvg := $(call filter-buildable,xvg) +files.svg := $(call filter-buildable,svg) +files.png := $(call filter-buildable,png) +files.jpg := $(call filter-buildable,jpg) +files.eps.gz := $(call filter-buildable,eps.gz) + +# Make all pstex targets secondary. The pstex_t target requires the pstex +# target, and nothing else really depends on it, so it often gets deleted. +# This avoids that by allowing *all* fig files to be pstex targets, which is +# perfectly valid and causes no problems even if they're going to become eps +# files in the end. +.SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig)) + +# Top level sources that are built by default targets +default_files.tex := $(call filter-default,tex) +default_files.tex.sh := $(call filter-default,tex.sh) +default_files.tex.pl := $(call filter-default,tex.pl) +default_files.tex.py := $(call filter-default,tex.py) +default_files.rst := $(call filter-default,rst) +default_files.gpi := $(call filter-default,gpi) +default_files.dot := $(call filter-default,dot) +default_files.fig := $(call filter-default,fig) +default_files.xvg := $(call filter-default,xvg) +default_files.svg := $(call filter-default,svg) +default_files.png := $(call filter-default,png) +default_files.jpg := $(call filter-default,jpg) +default_files.eps.gz := $(call filter-default,eps.gz) + +# Utility function for creating larger lists of files +# $(call concat-files,suffixes,[prefix]) +concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s)) + +# Useful file groupings +all_files_source := $(call concat-files,tex,all) +all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all) + +.PHONY: $(all_files_scripts) + +default_files_source := $(call concat-files,tex,default) +default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default) + +files_source := $(call concat-files,tex) +files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst) + +# Utility function for obtaining stems +# $(call get-stems,suffix,[prefix]) +get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%)) + +# List of all stems (including ._include_ and ._nobuild_ file stems) +all_stems.tex := $(call get-stems,tex,all) +all_stems.tex.sh := $(call get-stems,tex.sh,all) +all_stems.tex.pl := $(call get-stems,tex.pl,all) +all_stems.tex.py := $(call get-stems,tex.py,all) +all_stems.rst := $(call get-stems,rst,all) +all_stems.fig := $(call get-stems,fig,all) +all_stems.gpi := $(call get-stems,gpi,all) +all_stems.dot := $(call get-stems,dot,all) +all_stems.xvg := $(call get-stems,xvg,all) +all_stems.svg := $(call get-stems,svg,all) +all_stems.png := $(call get-stems,png,all) +all_stems.jpg := $(call get-stems,jpg,all) +all_stems.eps.gz := $(call get-stems,eps.gz,all) +all_stems.eps := $(call get-stems,eps,all) + +# List of all default stems (all default PDF targets): +default_stems.tex := $(call get-stems,tex,default) +default_stems.tex.sh := $(call get-stems,tex.sh,default) +default_stems.tex.pl := $(call get-stems,tex.pl,default) +default_stems.tex.py := $(call get-stems,tex.py,default) +default_stems.rst := $(call get-stems,rst,default) +default_stems.fig := $(call get-stems,fig,default) +default_stems.gpi := $(call get-stems,gpi,default) +default_stems.dot := $(call get-stems,dot,default) +default_stems.xvg := $(call get-stems,xvg,default) +default_stems.svg := $(call get-stems,svg,default) +default_stems.png := $(call get-stems,png,default) +default_stems.jpg := $(call get-stems,jpg,default) +default_stems.eps.gz := $(call get-stems,eps.gz,default) + +# List of all stems (all possible bare PDF targets created here): +stems.tex := $(call get-stems,tex) +stems.tex.sh := $(call get-stems,tex.sh) +stems.tex.pl := $(call get-stems,tex.pl) +stems.tex.py := $(call get-stems,tex.py) +stems.rst := $(call get-stems,rst) +stems.fig := $(call get-stems,fig) +stems.gpi := $(call get-stems,gpi) +stems.dot := $(call get-stems,dot) +stems.xvg := $(call get-stems,xvg) +stems.svg := $(call get-stems,svg) +stems.png := $(call get-stems,png) +stems.jpg := $(call get-stems,jpg) +stems.eps.gz := $(call get-stems,eps.gz) + +# Utility function for creating larger lists of stems +# $(call concat-stems,suffixes,[prefix]) +concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s))) + +# The most likely to be source but not finished product go first +graphic_source_extensions := fig \ + gpi \ + xvg \ + svg \ + dot \ + eps.gz + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +graphic_source_extensions += png jpg +graphic_target_extensions := eps ps +else +graphic_source_extensions += eps +graphic_target_extensions := pdf png jpg mps tif +endif + +all_stems_source := $(call concat-stems,tex,all) +all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all) +all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all) +all_stems_ss := $(sort $(all_stems_source) $(all_stems_script)) +all_stems_sg := $(sort $(all_stems_script)) +all_stems_ssg := $(sort $(all_stems_ss)) + +default_stems_source := $(call concat-stems,tex,default) +default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default) +default_stems_ss := $(sort $(default_stems_source) $(default_stems_script)) +default_stems_sg := $(sort $(default_stems_script)) +default_stems_ssg := $(sort $(default_stems_ss)) + +stems_source := $(call concat-stems,tex) +stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst) +stems_graphic := $(call concat-stems,$(graphic_source_extensions)) +stems_gg := $(sort $(stems_graphic)) +stems_ss := $(sort $(stems_source) $(stems_script)) +stems_sg := $(sort $(stems_script)) +stems_ssg := $(sort $(stems_ss)) + +# Calculate names that can generate the need for an include file. We can't +# really do this with patterns because it's too easy to screw up, so we create +# an exhaustive list. +allowed_source_suffixes := \ + pdf \ + ps \ + dvi \ + ind \ + nls \ + bbl \ + aux \ + aux.make \ + d \ + auxbbl.make \ + _graphics \ + _show +allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes)) + +allowed_graphic_suffixes := \ + pdf \ + eps \ + gpihead.make \ + gpi.d +allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes)) + +# All targets allowed to build documents +allowed_source_targets := \ + $(foreach suff,$(allowed_source_suffixes),\ + $(addsuffix .$(suff),$(stems_ssg))) + +# All targets allowed to build graphics +allowed_graphic_targets := \ + $(foreach suff,$(allowed_graphic_suffixes),\ + $(addsuffix .$(suff),$(stems_gg))) + +# All targets that build multiple documents (like 'all') +allowed_batch_source_targets := \ + all \ + all-pdf \ + all-ps \ + all-dvi \ + all-bbl \ + all-ind \ + all-gls \ + all-nls \ + show + +# All targets that build multiple graphics (independent of document) +allowed_batch_graphic_targets := \ + all-graphics \ + all-pstex \ + all-dot2tex \ + show-graphics + +# Now we figure out which stuff is available as a make target for THIS RUN. +real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\ + all) + +specified_source_targets := $(strip \ + $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \ + ) + +specified_batch_source_targets := $(strip \ + $(filter $(allowed_batch_source_targets),$(real_goals)) \ + ) + +specified_graphic_targets := $(strip \ + $(filter $(allowed_graphic_targets),$(real_goals)) \ + ) + +specified_batch_graphic_targets := $(strip \ + $(filter $(allowed_batch_graphic_targets),$(real_goals)) \ + ) + +specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\ + $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\ + $(all_files.gpi)) \ + ) + +# Determine which .d files need including from the information gained above. +# This is done by first checking whether a batch target exists. If it does, +# then all *default* stems are used to create possible includes (nobuild need +# not apply for batch status). If no batch targets exist, then the individual +# targets are considered and appropriate includes are taken from them. +source_stems_to_include := \ + $(sort\ + $(if $(specified_batch_source_targets),\ + $(default_stems_ss),\ + $(foreach t,$(specified_source_targets),\ + $(foreach p,$(allowed_source_patterns),\ + $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \ + )) \ + )) + +# Determine which .gpi.d files are needed using the above information. We +# first check whether a batch target is specified, then check individual +# graphics that may have been specified. +graphic_stems_to_include := \ + $(sort\ + $(if $(specified_batch_graphic_targets),\ + $(default_stems.gpi),\ + $(foreach t,$(specified_gpi_targets),\ + $(foreach p,$(allowed_graphic_patterns),\ + $(patsubst $p,%,$(filter $p,$t)) \ + )) \ + )) + +# All dependencies for the 'all' targets +all_pdf_targets := $(addsuffix .pdf,$(stems_ssg)) +all_ps_targets := $(addsuffix .ps,$(stems_ssg)) +all_dvi_targets := $(addsuffix .dvi,$(stems_ssg)) +all_tex_targets := $(addsuffix .tex,$(stems_sg)) +all_d_targets := $(addsuffix .d,$(stems_ssg)) +all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg)) +intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),) +all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig)) +all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot)) + +all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension))) + +default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss)) +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +default_ps_targets := $(addsuffix .ps,$(default_stems_ss)) +default_dvi_targets := $(addsuffix .dvi,$(default_stems_ss)) +pre_pdf_extensions := dvi ps +endif + +# Extensions generated by LaTeX invocation that can be removed when complete +rm_ext := \ + log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \ + fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf +backup_patterns := *~ *.bak *.backup body.tmp head.tmp + +graph_stem := _graph + +# All LaTeX-generated files that can be safely removed + +rm_tex := \ + $(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \ + $(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \ + $(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \ + $(addsuffix .*.log,$(stems_graphic)) + +# These are the files that will affect .gpi transformation for all .gpi files. +# +# Use only the first one found. Backward compatible values are at the end. +# Note that we use foreach, even though wildcard also returns a list, to ensure +# that the order in the uppercase variables is preserved. Directory listings +# provide no such guarantee, so we avoid relying on them. +gpi_sed := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f)))) +gpi_global := $(strip \ + $(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f)))) + +# +# Functions used in generating output +# + +# Outputs all source dependencies to stdout. The first argument is the file to +# be parsed, the second is a list of files that will show up as dependencies in +# the new .d file created here. +# +# NOTE: BSD sed does not understand \|, so we have to do something more +# clunky to extract suitable extensions. +# +# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure +# that we can properly backslash-escape spaces in file names (e.g, on Cygwin +# for tex distributions that have "Program Files" in their name). +# +# $(call get-inputs,,) +define get-inputs +$(SED) \ +-e '/^INPUT/!d' \ +-e 's!^INPUT \(\./\)\{0,1\}!!' \ +-e 's/[[:space:]]/\\ /g' \ +-e 's/\(.*\)\.aux$$/\1.tex/' \ +-e '/\.tex$$/b addtargets' \ +-e '/\.cls$$/b addtargets' \ +-e '/\.sty$$/b addtargets' \ +-e '/\.pstex_t$$/b addtargets' \ +-e '/\.dot_t$$/b addtargets' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# $(call get-missing-inputs,,) +define get-missing-inputs +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/Default extension: /!d' \ +-e 's/[[:space:]]\{1,\}/ /g' \ +-e 's/\n\{1,\}/ /g' \ +-e 's/^.*File `//' \ +-e 's/'"'"' not found\..*//' \ +-e '/\.tex/!s/$$/.tex/' \ +-e 's/[[:space:]]/\\ /g' \ +-e 'h' \ +-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/^/$2: /' \ +$1 | $(SORT) | $(UNIQ) +endef + +# Get source file for specified graphics stem. +# +# $(call graphics-source,) +define graphics-source +$(strip $(firstword \ + $(wildcard \ + $(addprefix $1.,\ + $(graphic_source_extensions))) \ + $1 \ +)) +endef + +# Get the target file for the specified graphics file/stem +# +# $(call graphics-target,) +define graphics-target +$(strip $(if $(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1, + $(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension)))) +endef + +# Outputs all of the graphical dependencies to stdout. The first argument is +# the stem of the source file being built, the second is a list of suffixes +# that will show up as dependencies in the generated .d file. +# +# Note that we try to escape spaces in filenames where possible. We have to do +# it with three backslashes so that as the name percolates through the makefile +# it eventually ends up with the proper escaping when the build rule is found. +# Ugly, but it appears to work. Note that graphicx doesn't allow filenames +# with spaces, so this could in many ways be moot unless you're using something +# like grffile. +# +# For pdflatex, we really need the missing file to be specified without an +# extension, otherwise compilation barfs on the first missing file. Truly +# annoying, but there you have it. +# +# It turns out that the graphics errors, although they have lines with empty +# space, are only made of two paragraphs. So, we just use some sed magic to +# get everything into paragraphs, detect when it's a paragraph that interests +# us, and double it up. Then we get the filename only if we're missing +# extensions (a sign that it's graphicx complaining). +# +# $(call get-graphics,) +#.log,$(addprefix $*.,d $(build_target_extension) _graphics) +define get-graphics +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File `/{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/{' \ +-e ' s/\n\{1,\}/ /g' \ +-e ' s/[[:space:]]\{1,\}/ /g' \ +-e ' s/^.*File `//' \ +-e ' s/'"'"' not found\..*//' \ +-e ' h' \ +-e ' s/.*/# MISSING stem "&" - (presence of comment affects build)/' \ +-e ' p' \ +-e ' g' \ +-e ' b addtargets' \ +-e '}' \ +-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \ +-e ' s//\1/' \ +-e ' b addtargets' \ +-e '}' \ +-e 'd' \ +-e ':addtargets' \ +-e 's/[[:space:]]/\\\\\\&/g' \ +-e 'h' \ +-e 's/.*/-include &.gpi.d/' \ +-e 'p' \ +-e 'g' \ +-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \ +-e 'p' \ +-e 's/.*//' \ +-e 'x' \ +-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \ +-e 'p' \ +-e 'd' \ +$*.log +endef + +# Checks for build failure due to pstex inclusion, and gives instructions. +# +# $(call die-on-pstexs,) +define die-on-pstexs +if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-pstex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for build failure due to dot2tex, and gives instructions. +# +# $(call die-on-dot2tex,) +define die-on-dot2tex +if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \ + $(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ + $(ECHO) "$(C_ERROR) make all-dot2tex$(C_RESET)"; \ + $(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ + exit 1; \ +fi +endef + +# Checks for the existence of a .aux file, and dies with an error message if it +# isn't there. Note that we pass the file stem in, not the full filename, +# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo) +# +# $(call die-on-no-aux,) +define die-on-no-aux +if [ ! -e '$1.aux' ]; then \ + $(call colorize-latex-errors,$1.log); \ + exit 1; \ +fi +endef + +# Outputs all index files to stdout. Arg 1 is the source file stem, arg 2 is +# the list of targets for the discovered dependency. +# +# $(call get-log-index,,) +define get-log-index +$(SED) \ +-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \ +-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \ +-e 's/[[:space:]]/\\&/g' \ +-e '/^TARGETS=/{' \ +-e ' h' \ +-e ' s/^TARGETS=/$2: /p' \ +-e ' g' \ +-e ' s/^TARGETS=\(.*\)/\1: $1.tex/p' \ +-e '}' \ +-e 'd' \ +'$1.log' | $(SORT) | $(UNIQ) +endef + + +# Outputs all bibliography files to stdout. Arg 1 is the source stem, arg 2 is +# a list of targets for each dependency found. +# +# The script kills all lines that do not contain bibdata. Remaining lines have +# the \bibdata macro and delimiters removed to create a dependency list. A +# trailing comma is added, then all adjacent commas are collapsed into a single +# comma. Then commas are replaced with the string .bib[space], and the +# trailing space is killed off. Finally, all filename spaces are escaped. +# This produces a list of space-delimited .bib filenames, which is what the +# make dep file expects to see. +# +# Note that we give kpsewhich a bogus argument so that a failure of sed to +# produce output will not cause an error. +# +# $(call get-bibs,,) +define get-bibs +$(SED) \ +-e '/^\\bibdata/!d' \ +-e 's/\\bibdata{\([^}]*\)}/\1,/' \ +-e 's/,\{2,\}/,/g' \ +-e 's/[[:space:]]/\\&/g' \ +-e 's/,/.bib /g' \ +-e 's/ \{1,\}$$//' \ +$1 | $(XARGS) $(KPSEWHICH) '#######' | \ +$(SED) \ +-e 's/^/$2: /' | \ +\$(SORT) | $(UNIQ) +endef + +# Makes a an aux file that only has stuff relevant to the target in it +# $(call make-auxtarget-file,,) +define make-auxtarget-file +$(SED) \ +-e '/^\\newlabel/!d' \ +$1 > $2 +endef + +# Makes an aux file that only has stuff relevant to the bbl in it +# $(call make-auxbbl-file,,) +define make-auxbbl-file +$(SED) \ +-e '/^\\newlabel/d' \ +$1 > $2 +endef + +# Makes a .gpi.d file from a .gpi file +# $(call make-gpi-d,<.gpi>,<.gpi.d>) +define make-gpi-d +$(ECHO) '# vim: ft=make' > $2; \ +$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \ +$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \ +$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \ +$(ECHO) 'endif' >> $2; +endef + +# Parse .gpi files for data and loaded dependencies, output to stdout +# +# The sed script here tries to be clever about obtaining valid +# filenames from the gpi file. It assumes that the plot command starts its own +# line, which is not too difficult a constraint to satisfy. +# +# This command script also generates 'include' directives for every 'load' +# command in the .gpi file. The load command must appear on a line by itself +# and the file it loads must have the suffix .gpi. If you don't want it to be +# compiled when running make graphics, then give it a suffix of ._include_.gpi. +# +# $(call get-gpi-deps,,) +define get-gpi-deps +$(SED) \ +-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \ +-e ' H' \ +-e ' /[^\\]$$/{' \ +-e ' s/.*//' \ +-e ' x' \ +-e ' s/\\\{0,1\}\n//g' \ +-e ' s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \ +-e ' s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \ +-e ' s/,['\''"]-\{0,1\}['\''"]//g' \ +-e ' s/[,'\''"]\{1,\}/ /g' \ +-e ' s!.*!$2: &!' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \ +-e 'd' \ +$1 +endef + +# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with +# recompilation. +# +# Note that we only ignore file not found errors for things that we know how to +# build, like graphics files. +# +# $(call colorize-latex-errors,) +define colorize-latex-errors +$(SED) \ +-e '$$ b para' \ +-e '/^$$/b para' \ +-e 'H' \ +-e 'd' \ +-e ':para' \ +-e 'x' \ +-e '/^$$/d' \ +-e 's/^\n*//' \ +-e '/^! LaTeX Error: File /{' \ +-e ' s/^/::DOUBLE_PARAGRAPH::/' \ +-e ' h' \ +-e ' d' \ +-e '}' \ +-e 's/^::DOUBLE_PARAGRAPH:://' \ +-e '/could not locate the file with any of these extensions:/d' \ +-e '/Missing .begin.document/{' \ +-e ' h' \ +-e ' s/.*/Are you trying to build an include file?/' \ +-e ' x' \ +-e ' G' \ +-e '}' \ +-e '/ LaTeX Error: Cannot determine size/d' \ +-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \ +-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \ +-e ' s//\1/' \ +-e ' /^$(hyperref_driver_pattern)$$/!{' \ +-e ' s/.*//' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \ +-e ' p' \ +-e ' }' \ +-e ' d' \ +-e '}' \ +-e '/ LaTeX Error: Unknown graphics extension/{' \ +-e ' s/^/ /' \ +-e ' h' \ +-e ' s/.*/--- Graphics extension error:/' \ +-e ' G' \ +-e ' h' \ +-e ' s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \ +-e ' H' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e ' s/.*//' \ +-e ' h' \ +-e ' b' \ +-e '}' \ +-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \ +-e 'd' \ +$1 +endef + +# Colorize Makeindex errors +define colorize-makeindex-errors +$(SED) \ +-e '/^!! /{' \ +-e ' N' \ +-e ' s/^.*$$/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize epstopdf errors +# +# $(call colorize-epstopdf-errors,) +define colorize-epstopdf-errors +$(SED) \ +-e '/^Error:/,/^Execution stack:/{' \ +-e ' /^Execution stack:/d' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GNUplot errors +# +# $(call colorize-gnuplot-errors,) +define colorize-gnuplot-errors +$(SED) \ +-e '/, line [0-9]*:/!{' \ +-e ' H' \ +-e ' x' \ +-e ' s/.*\n\(.*\n.*\)$$/\1/' \ +-e ' x' \ +-e '}' \ +-e '/, line [0-9]*:/{' \ +-e ' H' \ +-e ' /unknown.*terminal type/{' \ +-e ' s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \ +-e ' H' \ +-e ' }' \ +-e ' /gpihead/{' \ +-e ' s/.*/--- This could be a Makefile bug - contact the maintainer./' \ +-e ' H' \ +-e ' }' \ +-e ' g' \ +-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e '/^gnuplot>/,/^$$/{' \ +-e ' s/^gnuplot.*/$(C_ERROR)&/' \ +-e ' s/^$$/$(C_RESET)/' \ +-e ' p' \ +-e '}' \ +-e 'd' \ +$1 +endef + +# Colorize GraphViz errors +# +# $(call colorize-dot-errors,) +define colorize-dot-errors +$(SED) \ +-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \ +-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \ +-e 'd' \ +'$1' +endef + +# Get all important .aux files from the top-level .aux file and merges them all +# into a single file, which it outputs to stdout. +# +# $(call flatten-aux,,) +define flatten-aux +$(SED) \ +-e '/\\@input{\(.*\)}/{' \ +-e 's//\1/' \ +-e 's![.:]!\\&!g' \ +-e 'h' \ +-e 's!.*!\\:\\\\@input{&}:{!' \ +-e 'p' \ +-e 'x' \ +-e 's/\\././g' \ +-e 's/.*/r &/p' \ +-e 's/.*/d/p' \ +-e 's/.*/}/p' \ +-e 'd' \ +-e '}' \ +-e 'd' \ +'$1' > "$1.$$$$.sed.make"; \ +$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \ +$(SED) \ +-e '/^\\relax/d' \ +-e '/^\\bibcite/d' \ +-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \ +"$1.$$$$.make" | $(SORT) > '$2'; \ +$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make) +endef + +# Generate pdf from postscript +# +# Note that we don't just call ps2pdf, since there are so many versions of that +# script on various systems. Instead, we call the postscript interpreter +# directly. +# +# $(call ps2pdf,infile,outfile,[embed fonts]) +define ps2pdf + $(GS) \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -q -dNOPAUSE -dBATCH \ + -sDEVICE=pdfwrite -sstdout=%stderr \ + '-sOutputFile=$2' \ + -dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ + $(if $3,$(PS_EMBED_OPTIONS)) \ + -c .setpdfwrite \ + -f '$1' +endef + +# Colorize LaTeX output. +# This uses a neat trick from the Sed & Awk Book from O'Reilly: +# 1) If a line has a single ending paren, delete it to make a blank line (so +# that we catch the first error, which is not always preceded by a blank +# line). +# 2) Ensure that the last line of the file gets appended to the hold buffer, +# and blank it out to trigger end-of-paragraph logic below. +# 3) When encountering a blank line (LaTeX output helpfully breaks output on +# newlines) +# a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer), +# b) remove the newline at the beginning (don't ask), +# c) apply any colorizing substitutions necessary to ensure happiness. +# d) get the newline out of the hold buffer and append it +# e) profit! (print) +# 4) Anything not colorized is deleted, unless in verbose mode. +color_tex := \ + $(SED) \ + -e '$${' \ + -e ' /^$$/!{' \ + -e ' H' \ + -e ' s/.*//' \ + -e ' }' \ + -e '}' \ + -e '/^$$/!{' \ + -e ' H' \ + -e ' d' \ + -e '}' \ + -e '/^$$/{' \ + -e ' x' \ + -e ' s/^\n//' \ + -e ' /Output written on /{' \ + -e ' s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success! Wrote \2 to \1/' \ + -e ' s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \ + -e ' s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \ + -e ' s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' / *LaTeX Error:.*/{' \ + -e ' s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /.*Warning:.*/{' \ + -e ' s//$(C_WARNING)&$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Underfull.*/{' \ + -e ' s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + -e ' /Overfull.*/{' \ + -e ' s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \ + -e ' b end' \ + -e ' }' \ + $(if $(VERBOSE),,-e ' d') \ + -e ' :end' \ + -e ' G' \ + -e '}' \ + +# Colorize BibTeX output. +color_bib := \ + $(SED) \ + -e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \ + -e '/---/,/^.[^:]/{' \ + -e ' H' \ + -e ' /^.[^:]/{' \ + -e ' x' \ + -e ' s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \ + -e ' p' \ + -e ' s/.*//' \ + -e ' h' \ + -e ' d' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \ + $(if $(VERBOSE),,-e 'd') + + +# Make beamer output big enough to print on a full page. Landscape doesn't +# seem to work correctly. +enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter + +# $(call test-run-again,) +test-run-again = $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log + +# This tests whether the build target commands should be run at all, from +# viewing the log file. +# $(call test-log-for-need-to-run,) +define test-log-for-need-to-run +$(SED) \ +-e '/^No file $(call escape-dots,$1)\.aux\./d' \ +$1.log \ +| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$' +endef + +# LaTeX invocations +# +# $(call latex,,[]) +run-latex = $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null + +# $(call latex-color-log,) +latex-color-log = $(color_tex) $1.log + +# $(call run-makeindex,,,,) +define run-makeindex +success=1; \ +if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \ + $(call colorize-makeindex-errors,$3); \ + $(RM) -f '$2'; \ + success=0; \ +fi; \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# This runs the given script to generate output, and it uses MAKE_RESTARTS to +# ensure that it never runs it more than once for a particular root make +# invocation. +# +# $(call run-script,,,) +define run-script +[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \ +restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \ +level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \ +if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \ + $(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \ + $1 '$2' '$3'; \ + $(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \ + $(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \ +fi +endef + +# BibTeX invocations +# +# $(call run-bibtex,) +run-bibtex = $(BIBTEX) $1 | $(color_bib) + + +# $(call convert-eps-to-pdf,,,[gray]) +# Note that we don't use the --filter flag because it has trouble with bounding boxes that way. +define convert-eps-to-pdf +$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \ +$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \ +$(call colorize-epstopdf-errors,$1.log); +endef + +# $(call convert-gpi,,,[gray]) +# +define convert-gpi +$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \ +$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \ +$(firstword \ + $(shell \ + $(SED) \ + -e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \ + -e 'd' \ + $1 $(strip $(gpi_global)) \ + ) \ +) \ +),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \ +$(strip $(if $3,monochrome,$(if \ +$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\ +,color))) > $1head.make; \ +$(ECHO) 'set output "$2"' >> $1head.make; \ +$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \ +fnames='$1head.make $1';\ +$(if $(gpi_sed),\ + $(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \ + fnames=$1.temp.make;,\ +) \ +success=1; \ +if ! $(GNUPLOT) $$fnames 2>$1.log; then \ + $(call colorize-gnuplot-errors,$1.log); \ + success=0; \ +fi; \ +$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \ +$(call remove-temporary-files,$1head.make); \ +[ "$$success" = "1" ] && $(sh_true) || $(sh_false); +endef + +# Creation of .eps files from .png files +# +# The intermediate step of PNM (using NetPBM) produces much nicer output than +# ImageMagick's "convert" binary. I couldn't get the right combination of +# flags to make it look nice, anyway. +# +# To handle gray scale conversion, we pipe things through ppmtopgm in the +# middle. +# +# $(call convert-png,,) +define convert-png +$(PNGTOPNM) "$1" \ + $(if $3,| $(PPMTOPGM),) \ + | $(PNMTOPS) -noturn \ + > "$2" +endef + +# Creation of .eps files from .jpg files +# +# Thanks to brubakee for this solution. +# +# Uses Postscript level 2 to avoid file size bloat +# $(call convert-jpg,,) +define convert-jpg +$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2' +endef + +# Creation of .eps files from .fig files +# $(call convert-fig,,,[gray]) +convert-fig = $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2 + +# Creation of .pstex files from .fig files +# $(call convert-fig-pstex,,) +convert-fig-pstex = $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1 + +# Creation of .pstex_t files from .fig files +# $(call convert-fig-pstex-t,,,) +convert-fig-pstex-t = $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1 + +# Creation of .dot_t files from .dot files +# #(call convert-dot-tex,,) +convert-dot-tex = $(DOT2TEX) '$1' > '$2' + +# Converts svg files into .eps files +# +# $(call convert-svg,,,[gray]) +convert-svg = $(INKSCAPE) --export-eps='$2' '$1' + +# Converts xvg files into .eps files +# +# $(call convert-xvg,,,[gray]) +convert-xvg = $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2' + +# Converts .eps.gz files into .eps files +# +# $(call convert-epsgz,,,[gray]) +convert-epsgz = $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2' + +# Converts .eps files into .eps files (usually a no-op, but can make grayscale) +# +# $(call convert-eps,,,[gray]) +convert-eps = $(if $3,$(call kill-ps-color) $1 > $2) + +# The name of the file containing special postscript commands for grayscale +gray_eps_file := gray.eps.make + +# Changes sethsbcolor and setrgbcolor calls in postscript to always produce +# grayscale. In general, this is accomplished by writing new versions of those +# functions into the user dictionary space, which is looked up before the +# global or system dictionaries (userdict is one of the permanent dictionaries +# in postscript and is not read-only like systemdict). +# +# For setrgbcolor, the weighted average of the triple is computed and the +# triple is replaced with three copies of that average before the original +# procedure is called: .299R + .587G + .114B +# +# For sethsbcolor, the color is first converted to RGB, then to grayscale by +# the new setrgbcolor operator as described above. Why is this done? +# Because simply using the value component will tend to make pure colors +# white, a very undesirable thing. Pure blue should not translate to white, +# but to some level of gray. Conversion to RGB does the right thing. It's +# messy, but it works. +# +# From +# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB, +# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is +# as follows: +# +# Hi = int(floor(6 * H)) mod 6 +# f = 6 * H - Hi +# p = V(1-S) +# q = V(1-fS) +# t = V(1-(1-f)S) +# if Hi = 0: R G B <-- V t p +# if Hi = 1: R G B <-- q V p +# if Hi = 2: R G B <-- p V t +# if Hi = 3: R G B <-- p q V +# if Hi = 4: R G B <-- t p V +# if Hi = 5: R G B <-- V p q +# +# The messy stack-based implementation is below +# $(call create-gray-eps-file,filename) +define create-gray-eps-file +$(ECHO) -n -e '\ +/OLDRGB /setrgbcolor load def\n\ +/setrgbcolor {\n\ + .114 mul exch\n\ + .587 mul add exch\n\ + .299 mul add\n\ + dup dup\n\ + OLDRGB\n\ +} bind def\n\ +/OLDHSB /sethsbcolor load def\n\ +/sethsbcolor {\n\ + 2 index % H V S H\n\ + 6 mul floor cvi 6 mod % Hi V S H\n\ + 3 index % H Hi V S H\n\ + 6 mul % 6H Hi V S H\n\ + 1 index % Hi 6H Hi V S H\n\ + sub % f Hi V S H\n\ + 2 index 1 % 1 V f Hi V S H\n\ + 4 index % S 1 V f Hi V S H\n\ + sub mul % p f Hi V S H\n\ + 3 index 1 % 1 V p f Hi V S H\n\ + 6 index % S 1 V p f Hi V S H\n\ + 4 index % f S 1 V p f Hi V S H\n\ + mul sub mul % q p f Hi V S H\n\ + 4 index 1 1 % 1 1 V q p f Hi V S H\n\ + 5 index % f 1 1 V q p f Hi V S H\n\ + sub % (1-f) 1 V q p f Hi V S H\n\ + 8 index % S (1-f) 1 V q p f Hi V S H\n\ + mul sub mul % t q p f Hi V S H\n\ + 4 -1 roll pop % t q p Hi V S H\n\ + 7 -2 roll pop pop % t q p Hi V\n\ + 5 -2 roll % Hi V t q p\n\ + dup 0 eq\n\ + {1 index 3 index 6 index}\n\ + {\n\ + dup 1 eq\n\ + {3 index 2 index 6 index}\n\ + {\n\ + dup 2 eq\n\ + {4 index 2 index 4 index}\n\ + {\n\ + dup 3 eq\n\ + {4 index 4 index 3 index}\n\ + {\n\ + dup 4 eq\n\ + {2 index 5 index 3 index}\n\ + {\n\ + dup 5 eq\n\ + {1 index 5 index 5 index}\n\ + {0 0 0}\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse\n\ + }\n\ + ifelse % B G R Hi V t q p\n\ + setrgbcolor\n\ + 5 {pop} repeat\n\ +} bind def\n'\ +> $1 +endef + +# This actually inserts the color-killing code into a postscript file +# $(call kill-ps-color) +define kill-ps-color +$(SED) -e '/%%EndComments/r $(gray_eps_file)' +endef + +# Converts graphviz .dot files into .eps files +# Grayscale is not directly supported by dot, so we pipe it through fig2dev in +# that case. +# $(call convert-dot,,,,[gray]) +define convert-dot +$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \ +$(call colorize-dot-errors,$3) +endef + +# Convert DVI to Postscript +# $(call make-ps,,,,[]) +make-ps = \ + $(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \ + $(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1 + +# Convert Postscript to PDF +# $(call make-pdf,,,,) +make-pdf = \ + $(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1 + +# Display information about what is being done +# $(call echo-build,,,[]) +echo-build = $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)" +echo-graphic = $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)" +echo-dep = $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)" + +# Display a list of something +# $(call echo-list,) +echo-list = for x in $1; do $(ECHO) "$$x"; done + +# +# DEFAULT TARGET +# + +.PHONY: all +all: $(default_pdf_targets) ; + +.PHONY: all-pdf +all-pdf: $(default_pdf_targets) ; + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-ps +all-ps: $(default_ps_targets) ; + +.PHONY: all-dvi +all-dvi: $(default_dvi_targets) ; +endif + +# +# VIEWING TARGET +# +.PHONY: show +show: all + $(QUIET)for x in $(default_pdf_targets); do \ + [ -e "$$x" ] && $(VIEW_PDF) $$x & \ + done + +# +# INCLUDES +# +source_includes := $(addsuffix .d,$(source_stems_to_include)) +graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include)) + +# Include only the dependencies used +ifneq "" "$(source_includes)" +include $(source_includes)$(call include-message,$(source_includes)) +endif +ifneq "" "$(graphic_includes)" +include $(graphic_includes)$(call include-message,$(graphic_includes)) +endif + +# +# MAIN TARGETS +# + +# Note that we don't just say %: %.pdf here - this can tend to mess up our +# includes, which detect what kind of file we are asking for. For example, +# asking to build foo.pdf is much different than asking to build foo when +# foo.gpi exists, because we look through all of the goals for *.pdf that +# matches *.gpi, then use that to determine which include files we need to +# build. +# +# Thus, we invoke make recursively with better arugments instead, restarting +# all of the appropriate machinery. +.PHONY: $(default_stems_ss) +$(default_stems_ss): %: %.pdf ; + +# This builds and displays the wanted file. +.PHONY: $(addsuffix ._show,$(stems_ssg)) +%._show: %.pdf + $(QUIET)$(VIEW_PDF) $< & + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_pdf_targets) +%.pdf: %.ps %.embed.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi + +.SECONDARY: $(all_ps_targets) +%.ps: %.dvi %.paper.make + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-ps,$<,$@.temp,$@.log,\ + $(firstword $(shell $(CAT) $*.paper.make))); \ + if [ x"$$?" = x"0" ]; then \ + $(if $(VERBOSE),$(CAT) $@.log,:); \ + $(RM) -f '$@'; \ + $(MV) '$@.temp' '$@'; \ + $(TOUCH) '$@'; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + else \ + $(CAT) $@.log; \ + $(call remove-temporary-files,'$@.temp'); \ + $(sh_false); \ + fi +endif + +# Build the final target (dvi or pdf) file. This is a very tricky rule because +# of the way that latex runs multiple times, needs graphics after the first run +# (or maybe already has them), and relies on bibliographies or indices that may +# not exist. +# +# Check the log for fatal errors. If they exist, colorize and bail. +# +# Create the .auxtarget.cookie file. (Needed for next time if not present) +# +# If any of the following are true, we must rebuild at least one time: +# +# * the .bbl was recently rebuilt +# +# check a cookie, then delete it +# +# * any of several output files was created or changed: +# +# check $*.run.cookie, then delete it +# +# * the .aux file changed in a way that necessitates attention +# +# Note that if the .auxtarget.make file doesn't exist, this means +# that we are doing a clean build, so it doesn't figure into the +# test for running again. +# +# compare against .auxtarget.make +# +# move if different, remove if not +# +# * the .log file has errors or warnings requiring at least one more run +# +# We use a loop over a single item to simplify the process of breaking +# out when we find one of the conditions to be true. +# +# If we do NOT need to run latex here, then we move the $@.1st.make file +# over to $@ because the target file has already been built by the first +# dependency run and is valid. +# +# If we do, we delete that cookie file and do the normal multiple-runs +# routine. +# +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.SECONDARY: $(all_dvi_targets) +endif +%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make + $(QUIET)\ + fatal=`$(call colorize-latex-errors,$*.log)`; \ + if [ x"$$fatal" != x"" ]; then \ + $(ECHO) "$$fatal"; \ + exit 1; \ + fi; \ + $(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \ + run=0; \ + for i in 1; do \ + if $(call test-exists,$*.bbl.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call test-exists,$*.run.cookie); then \ + run=1; \ + break; \ + fi; \ + if $(call \ + test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\ + then \ + run=1; \ + break; \ + fi; \ + if $(call test-log-for-need-to-run,$*); then \ + run=1; \ + break; \ + fi; \ + done; \ + $(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \ + $(MV) $*.auxtarget.cookie $*.auxtarget.make; \ + if [ x"$$run" = x"1" ]; then \ + $(call remove-files,$@.1st.make); \ + for i in 2 3 4 5; do \ + $(if $(findstring 3.79,$(MAKE_VERSION)),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\ + $(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\ + ); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \ + $(call test-run-again,$*) || break; \ + done; \ + else \ + $(MV) '$@.1st.make' '$@'; \ + fi; \ + $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ + $(call latex-color-log,$*) + +# Build the .bbl file. When dependencies are included, this will (or will +# not!) depend on something.bib, which we detect, acting accordingly. The +# dependency creation also produces the %.auxbbl.make file. BibTeX is a bit +# finicky about what you call the actual files, but we can rest assured that if +# a .auxbbl.make file exists, then the .aux file does, as well. The +# .auxbbl.make file is a cookie indicating whether the .bbl needs to be +# rewritten. It only changes if the .aux file changes in ways relevant to .bbl +# creation. +# +# Note that we do NOT touch the .bbl file if there is no need to +# create/recreate it. We would like to leave existing files alone if they +# don't need to be changed, thus possibly avoiding a rebuild trigger. +%.bbl: %.auxbbl.make + $(QUIET)\ + $(if $(filter %.bib,$^),\ + $(call echo-build,$(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \ + $(call run-latex,$*); \ + $(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \ + $(if $(filter %.bib,$^),\ + $(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \ + $(call run-bibtex,$*); \ + $(TOUCH) $@.cookie; \ + ) \ + $(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \ + $(call run-latex,$*); \ + fi + +# Create the index file - note that we do *not* depend on %.tex here, since +# that unnecessarily restricts the kinds of indices that we can build to those +# with exactly the same stem as the source file. Things like splitidx create +# idx files with other names. +# +# Therefore, we add the .tex dependency in the sourcestem.d file in the call to +# get index file dependencies from the logs. +%.ind: %.idx + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.ilg) + +# Create the glossary file +%.gls: %.glo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist) + +# Create the nomenclature file +%.nls: %.nlo %.tex + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist) + +# SCRIPTED LaTeX TARGETS +# +# Keep the generated .tex files around for debugging if needed. +.SECONDARY: $(all_tex_targets) + +%.tex:: %.tex.sh + $(QUIET)$(call run-script,$(SHELL),$<,$@) + +%.tex:: %.tex.py + $(QUIET)$(call run-script,$(PYTHON),$<,$@) + +%.tex:: %.tex.pl + $(QUIET)$(call run-script,$(PERL),$<,$@) + +%.tex:: %.rst $(RST_STYLE_FILE) + $(QUIET)\ + $(call run-script,$(RST2LATEX)\ + --documentoptions=letterpaper\ + $(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@) + +# +# GRAPHICS TARGETS +# +.PHONY: all-graphics +all-graphics: $(all_graphics_targets); + +ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex" +.PHONY: all-pstex +all-pstex: $(all_pstex_targets); +endif + +.PHONY: all-dot2tex +all-dot2tex: $(all_dot2tex_targets); + +.PHONY: show-graphics +show-graphics: all-graphics + $(VIEW_GRAPHICS) $(all_known_graphics) + +$(gray_eps_file): + $(QUIET)$(call echo-build,$^,$@) + $(QUIET)$(call create-gray-eps-file,$@) + +ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" +%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) + +ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf" +%.pdf: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) +endif + +%.pdf: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +endif + +%.eps: %.gpi %.gpi.d $(gpi_sed) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) + +%.eps: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig,$<,$@,$(GRAY)) + +%.eps: %.dot $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY)) + +%.eps: %.xvg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-xvg,$<,$@,$(GRAY)) + +%.eps: %.svg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-svg,$<,$@,$(GRAY)) + +%.eps: %.jpg $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) + +%.eps: %.png $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-png,$<,$@,$(GRAY)) + +%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file)) + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-epsgz,$<,$@,$(GRAY)) + +%.pstex: %.fig + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY)) + +%.pstex_t: %.fig %.pstex + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY)) + +%.dot_t: %.dot + $(QUIET)$(call echo-graphic,$^,$@) + $(QUIET)$(call convert-dot-tex,$<,$@) + +# +# DEPENDENCY-RELATED TARGETS. +# + +# Generate all of the information needed to get dependencies +# As a side effect, this creates a .dvi or .pdf file (depending on the build +# strategy). We need to be sure to remove it if there are errors. Errors can +# take several forms and all of them are found within the log file: +# * There was a LaTeX error +# * A needed file was not found +# * Cross references need adjustment +# +# Behavior: +# This rule is responsible for generating the following: +# %.aux +# %.d +# %.aux.make +# %.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved) +# +# Steps: +# +# Run latex +# Move .pdf or .dvi somewhere else (make no judgements about success) +# Flatten the .aux file into another file +# Add source dependencies +# Add graphic dependencies +# Add bib dependencies +# +# Create cookies for various suffixes that may represent files that +# need to be read by LaTeX in order for it to function properly. +# +# Note that if some of the dependencies are discovered because they turn +# up missing in the log file, we really need the .d file to be reloaded. +# Adding a sleep command helps with this. Otherwise make is extremely +# nondeterministic, sometimes working, sometimes not. +# +# Usually we can force this by simply removing the generated pdf file and +# not creating a .1st.make file.. +# +%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex + $(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1) + $(QUIET)\ + $(call run-latex,$<,--recorder) || $(sh_true); \ + $(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \ + $(call die-on-dot2tex,$*.log); \ + $(call die-on-no-aux,$*); \ + $(call flatten-aux,$*.aux,$*.aux.make); \ + $(ECHO) "# vim: ft=make" > $*.d; \ + $(ECHO) ".PHONY: $*._graphics" >> $*.d; \ + $(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ + $(ECHO) ".SECONDEXPANSION:" >> $*.d; \ + $(call get-graphics,$*) >> $*.d; \ + $(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \ + $(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \ + $(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \ + $(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \ + for s in toc out lot lof lol nav; do \ + if [ -e "$*.$$s" ]; then \ + if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \ + $(TOUCH) $*.run.cookie; \ + fi; \ + $(CP) $*.$$s $*.$$s.make; \ + fi; \ + done + +# This is a cookie that is updated if the flattened aux file has changed in a +# way that affects the bibliography generation. +.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg)) +%.auxbbl.make: %.aux.make + $(QUIET)\ + $(call make-auxbbl-file,$<,$@.temp); \ + $(call replace-if-different-and-remove,$@.temp,$@) + +# Build a dependency file for .gpi files. These often plot data files that +# also reside in the directory, so if a data file changes, it's nice to know +# about it. This also handles loaded .gpi files, whose filename should have +# _include_. in it. +%.gpi.d: %.gpi + $(QUIET)$(call echo-build,$<,$@) + $(QUIET)$(call make-gpi-d,$<,$@) + +# Store the paper size for this document -- note that if beamer is used we set +# it to the special BEAMER paper size. We only do this, however, if the +# special comment exists, in which case we enlarge the output with psnup. +# +# The paper size is extracted from a documentclass attribute. +%.paper.make: %.tex + $(QUIET)$(SED) \ + -e '/\\documentclass/,/}/{' \ + -e ' s/%.*//' \ + -e ' H' \ + -e ' /}/{' \ + -e ' s/.*//' \ + -e ' x' \ + -e ' /\\documentclass/!d' \ + -e ' s/[\n[:space:]]*//g' \ + -e ' s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \ + -e ' s/^[^%]*%-//' \ + -e ' s/-%[^%]*$$//' \ + -e ' s/-%[^%]%-/ /g' \ + -e ' p' \ + -e ' }' \ + -e ' d' \ + -e '}' \ + -e 'd' \ + $< > $@; \ + $(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \ + (\ + $(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \ + $(ECHO) "BEAMER" > $@ || \ + : > $@ \ + ) || $(sh_true) + +# Store embedding instructions for this document using a special comment +%.embed.make: %.tex + $(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \ + && $(ECHO) '' > $@ \ + || $(ECHO) '1' > $@; + +# +# HELPFUL PHONY TARGETS +# + +.PHONY: _all_programs +_all_programs: + $(QUIET)$(ECHO) "== All External Programs Used ==" + $(QUIET)$(call output-all-programs) + +.PHONY: _check_programs +_check_programs: + $(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO) + $(QUIET) \ + $(ECHO) hi; \ + allprogs=`\ + ($(call output-all-programs)) | \ + $(SED) \ + -e 's/^[[:space:]]*//' \ + -e '/^#/d' \ + -e 's/[[:space:]]*#.*//' \ + -e '/^=/s/[[:space:]]/_/g' \ + -e '/^[[:space:]]*$$/d' \ + -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \ + `; \ + spaces=' '; \ + for p in $${allprogs}; do \ + case $$p in \ + =*) $(ECHO); $(ECHO) "$$p";; \ + *) \ + $(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \ + loc=`$(WHICH) $$p`; \ + if [ x"$$?" = x"0" ]; then \ + $(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \ + else \ + $(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \ + fi; \ + ;; \ + esac; \ + done + +.PHONY: _check_gpi_files +_check_gpi_files: + $(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \ + $(ECHO); \ + for f in $(files.gpi); do \ + result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \ + $(ECHO) -n "$$f: "; \ + if [ x"$$result" = x"" ]; then \ + $(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \ + else \ + $(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\ + $(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \ + fi; \ + done; \ + $(ECHO) + +.PHONY: _all_stems +_all_stems: + $(QUIET)$(ECHO) "== All Stems ==" + $(QUIET)$(call echo-list,$(sort $(default_stems_ss))) + +.PHONY: _includes +_includes: + $(QUIET)$(ECHO) "== Include Stems ==" + $(QUIET)$(ECHO) "=== Sources ===" + $(QUIET)$(call echo-list,$(sort $(source_includes))) + $(QUIET)$(ECHO) "=== Graphics ===" + $(QUIET)$(call echo-list,$(sort $(graphic_includes))) + +.PHONY: _all_sources +_all_sources: + $(QUIET)$(ECHO) "== All Sources ==" + $(QUIET)$(call echo-list,$(sort $(all_files.tex))) + +.PHONY: _dependency_graph +_dependency_graph: + $(QUIET)$(ECHO) "/* LaTeX Dependency Graph */" + $(QUIET)$(call output-dependency-graph) + +.PHONY: _show_dependency_graph +_show_dependency_graph: + $(QUIET)$(call output-dependency-graph,$(graph_stem).dot) + $(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot + $(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps + $(QUIET)$(call remove-temporary-files,$(graph_stem).*) + +.PHONY: _sources +_sources: + $(QUIET)$(ECHO) "== Sources ==" + $(QUIET)$(call echo-list,$(sort $(files.tex))) + +.PHONY: _scripts +_scripts: + $(QUIET)$(ECHO) "== Scripts ==" + $(QUIET)$(call echo-list,$(sort $(files_scripts))) + +.PHONY: _graphic_outputs +_graphic_outputs: + $(QUIET)$(ECHO) "== Graphic Outputs ==" + $(QUIET)$(call echo-list,$(sort $(all_graphics_targets))) + +.PHONY: _env +_env: +ifdef .VARIABLES + $(QUIET)$(ECHO) "== MAKE VARIABLES ==" + $(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)')) +endif + $(QUIET)$(ECHO) "== ENVIRONMENT ==" + $(QUIET)$(ENV) + +# +# CLEAN TARGETS +# +# clean-generated is somewhat unique - it relies on the .fls file being +# properly built so that it can determine which of the files was generated, and +# which was not. Expect it to silently fail if the .fls file is missing. +# +# This is used to, e.g., clean up index files that are generated by the LaTeX. +.PHONY: clean-generated +clean-generated: + $(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\ + $(shell $(call get-generated-names,$e)))) + +.PHONY: clean-deps +clean-deps: + $(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie) + +.PHONY: clean-tex +clean-tex: clean-deps + $(QUIET)$(call clean-files,$(rm_tex)) + +.PHONY: clean-graphics +# TODO: This *always* deletes pstex files, even if they were not generated by +# anything.... In other words, if you create a pstex and pstex_t pair by hand +# an drop them in here without the generating fig file, they will be deleted +# and you won't get them back. It's a hack put in here because I'm not sure we +# even want to keep pstex functionality, so my motivation is not terribly high +# for doing it right. +clean-graphics: + $(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t) + +.PHONY: clean-backups +clean-backups: + $(QUIET)$(call clean-files,$(backup_patterns) *.temp) + +.PHONY: clean-auxiliary +clean-auxiliary: + $(QUIET)$(call clean-files,$(graph_stem).*) + +.PHONY: clean-nographics +clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ; + +.PHONY: clean +clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary + +# +# HELP TARGETS +# + +.PHONY: help +help: + $(help_text) + +.PHONY: version +version: + $(QUIET)\ + $(ECHO) "$(fileinfo) Version $(version)"; \ + $(ECHO) "by $(author)"; \ + +# +# HELP TEXT +# + +define help_text +# $(fileinfo) Version $(version) +# +# by $(author) +# +# Generates a number of possible output files from a LaTeX document and its +# various dependencies. Handles .bib files, \include and \input, and .eps +# graphics. All dependencies are handled automatically by running LaTeX over +# the source. +# +# USAGE: +# +# make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] +# +# STANDARD OPTIONS: +# GRAY: +# Setting this variable forces all recompiled graphics to be grayscale. +# It is useful when creating a document for printing. The default is +# to allow colors. Note that it only changes graphics that need to be +# rebuilt! It is usually a good idea to do a 'make clean' first. +# +# VERBOSE: +# This turns off all @ prefixes for commands invoked by make. Thus, +# you get to see all of the gory details of what is going on. +# +# SHELL_DEBUG: +# This enables the -x option for sh, meaning that everything it does is +# echoed to stderr. This is particularly useful for debugging +# what is going on in $$(shell ...) invocations. One of my favorite +# debugging tricks is to do this: +# +# make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less +# +# STANDARD AUXILIARY FILES: +# +# Makefile.ini +# +# This file can contain variable declarations that override various +# aspects of the makefile. For example, one might specify +# +# neverclean := *.pdf *.ps +# onlysources.tex := main.tex +# LATEX_COLOR_WARNING := 'bold red uline' +# +# And this would override the neverclean setting to ensure that pdf +# and ps files always remain behind, set the makefile to treat all +# .tex files that are not "main.tex" as includes (and therefore not +# default targets). It also changes the LaTeX warning output to be +# red, bold, and underlined. +# +# There are numerous variables in this file that can be overridden in +# this way. Search for '?=' to find them all. +# +# Also, you can put arbitrary targets into it if, for example, you +# want your source built from something else, e.g.: +# +# generated.tex: generating_script.weird_lang depA depB +# ./generating_script.weird_lang > $$@ +# +# Note that if you are not careful, you can override the default +# target (what happens when you type "make" without arguments), so if +# you do use Makefile.ini, you probably want to start it with +# something like the following line: +# +# default: all +# +# Since the first target in any makefile is automatically the default, +# and the makefile already has a sensible "all" target, this will do +# what you want. +# +# The Makefile.ini is imported before *anything else* is done, so go +# wild with your ideas for changes to this makefile in there. It +# makes it easy to test them before submitting patches. +# +# STANDARD ENVIRONMENT VARIABLES: +# +# LATEX_COLOR_WARNING '$(LATEX_COLOR_WARNING)' +# LATEX_COLOR_ERROR '$(LATEX_COLOR_ERROR)' +# LATEX_COLOR_UNDERFULL '$(LATEX_COLOR_UNDERFULL)' +# LATEX_COLOR_OVERFULL '$(LATEX_COLOR_OVERFULL)' +# LATEX_COLOR_PAGES '$(LATEX_COLOR_PAGES)' +# LATEX_COLOR_BUILD '$(LATEX_COLOR_BUILD)' +# LATEX_COLOR_GRAPHIC '$(LATEX_COLOR_GRAPHIC)' +# LATEX_COLOR_DEP '$(LATEX_COLOR_DEP)' +# LATEX_COLOR_SUCCESS '$(LATEX_COLOR_SUCCESS)' +# LATEX_COLOR_FAILURE '$(LATEX_COLOR_FAILURE)' +# +# These may be redefined in your environment to be any of the following: +# +# black +# red +# green +# yellow +# blue +# magenta +# cyan +# white +# +# Bold or underline may be used, as well, either alone or in combination +# with colors: +# +# bold +# uline +# +# Order is not important. You may want, for example, to specify: +# +# export LATEX_COLOR_SUCCESS='bold blue uline' +# +# in your .bashrc file. I don't know why, but you may want to. +# +# STANDARD TARGETS: +# +# all: +# Make all possible documents in this directory. The documents are +# determined by scanning for .tex and .tex.sh (described in more detail +# later) and omitting any file that ends in ._include_.tex or +# ._nobuild_.tex. The output is a set of .pdf files. +# +# If you wish to omit files without naming them with the special +# underscore names, set the following near the top of the Makefile, +# or (this is recommended) within a Makefile.ini in the same directory: +# +# includes.tex := file1.tex file2.tex +# +# This will cause the files listed to be considered as include files. +# +# If you have only few source files, you can set +# +# onlysources.tex := main.tex +# +# This will cause only the source files listed to be considered in +# dependency detection. All other .tex files will be considered as +# include files. Note that these options work for *any* source type, +# so you could do something similar with includes.gpi, for example. +# Note that this works for *any valid source* target. All of the +# onlysources.* variables are commented out in the shipping version of +# this file, so it does the right thing when they simply don't exist. +# The comments are purely documentation. If you know, for example, that +# file.mycoolformat is supported by this Makefile, but don't see the +# "onlysources.mycoolformat" declared in the comments, that doesn't mean +# you can't use it. Go ahead and set "onlysources.mycoolformat" and it +# should do the right thing. +# +# show: +# Builds and displays all documents in this directory. It uses the +# environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to +# do its work. +# +# all-graphics: +# Make all of the graphics in this directory. +# +# all-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into pstex and pstex_t files. Gray DOES NOT WORK. +# +# all-gray-pstex (only for BUILD_STRATEGY=latex): +# Build all fig files into grayscale pstex and pstex_t files. +# +# all-dot2tex: +# Build all dot files into tex files. +# +# show-graphics: +# Builds and displays all graphics in this directory. Uses the +# environment-overridable value of VIEW_GRAPHICS (currently +# $(VIEW_GRAPHICS)) to do its work. +# +# clean: +# Remove ALL generated files, leaving only source intact. +# This will *always* skip files mentioned in the "neverclean" variable, +# either in this file or specified in Makefile.ini: +# +# neverclean := *.pdf *.ps +# +# The neverclean variable works on all "clean" targets below, as well. +# +# clean-graphics: +# Remove all generated graphics files. +# +# clean-backups: +# Remove all backup files: $(backup_patterns) +# (XFig and other editors have a nasty habit of leaving them around) +# Also removes Makefile-generated .temp files +# +# clean-tex: +# Remove all files generated from LaTeX invocations except dependency +# information. Leaves graphics alone. +# +# clean-deps: +# Removes all auto-generated dependency information. +# +# clean-auxiliary: +# Removes extra files created by various targets (like the dependency +# graph output). +# +# clean-nographics: +# Cleans everything *except* the graphics files. +# +# help: +# This help text. +# +# version: +# Version information about this LaTeX makefile. +# +# DEBUG TARGETS: +# +# _all_programs: +# A list of the programs used by this makefile. +# +# _check_programs: +# Checks your system for the needed software and reports what it finds. +# +# _check_gpi_files: +# Checks the .gpi files in the current directory for common errors, such +# as specification of the terminal or output file inside of the gpi file +# itself. +# +# _dependency_graph: +# Outputs a .dot file to stdout that represents a graph of LaTeX +# dependencies. To see it, use the _show_dependency_graph target or +# direct the output to a file, run dot on it, and view the output, e.g.: +# +# make _dependency_graph > graph.dot +# dot -T ps -o graph.eps graph.dot +# gv graph.eps +# +# _show_dependency_graph: +# Makes viewing the graph simple: extracts, builds and displays the +# dependency graph given in the _dependency_graph target using the value +# of the environment-overridable VIEW_POSTSCRIPT variable (currently set +# to $(VIEW_POSTSCRIPT)). The postscript viewer is used because it +# makes it easier to zoom in on the graph, a critical ability for +# something so dense and mysterious. +# +# _all_sources: +# List all .tex files in this directory. +# +# _sources: +# Print out a list of all compilable sources in this directory. This is +# useful for determining what make thinks it will be using as the +# primary source for 'make all'. +# +# _scripts: +# Print out a list of scripts that make knows can be used to generate +# .tex files (described later). +# +# _all_stems: +# Print a list of stems. These represent bare targets that can be +# executed. Listing as a bare target will produce .pdf. +# +# _includes: +# A list of .d files that would be included in this run if _includes +# weren't specified. This target may be used alone or in conjunction +# with other targets. +# +# _graphic_outputs: +# A list of all generated .eps files +# +# _env: +# A list of environment variables and their values. If supported by +# your version of make, also a list of variables known to make. +# +# FILE TARGETS: +# +# %, %.pdf: +# Build a PDF file from the corresponding %.tex file. +# +# If BUILD_STRATEGY=pdflatex, then this builds the pdf directly. +# Otherwise, it uses this old-school but effective approach: +# +# latex -> dvips -> ps2pdf +# +# The BUILD_STRATEGY can be overridden in Makefile.ini in the same +# directory. The default is pdflatex. +# +# Reasons for using latex -> dvips include the "psfrag" package, and the +# generation of postscript instead of PDF. Arguments for using pdflatex +# include "new and shiny" and "better supported." I can't argue with +# either of those, and supporting them both didn't turn out to be that +# difficult, so there you have it. Choices. +# +# %._show: +# A phony target that builds the pdf file and then displays it using the +# environment-overridable value of VIEW_PDF ($(VIEW_PDF)). +# +# %._graphics: +# A phony target that generates all graphics on which %.pdf (or %.dvi) +# depends. +# +# %.ps (only for BUILD_STRATEGY=latex): +# Build a Postscript file from the corresponding %.tex file. +# This is done using dvips. Paper size is automatically +# extracted from the declaration +# +# \documentclass[paper] +# +# or it is the system default. +# +# If using beamer (an excellent presentation class), the paper +# size is ignored. More on this later. +# +# %.dvi (only for BUILD_STRATEGY=latex): +# Build the DVI file from the corresponding %.tex file. +# +# %.ind: +# Build the index for this %.tex file. +# +# %.gls: +# Build the nomenclature glossary for this %.tex file. +# +# %.nls: +# Build the (newer) nomenclature file for this %.tex file. +# +# %.eps: +# Build an eps file from one of the following file types: +# +# .dot : graphviz +# .gpi : gnuplot +# .fig : xfig +# .xvg : xmgrace +# .svg : scalable vector graphics (goes through inkscape) +# .png : png (goes through NetPBM) +# .jpg : jpeg (goes through ImageMagick) +# .eps.gz : gzipped eps +# +# The behavior of this makefile with each type is described in +# its own section below. +# +# %.pstex{,_t} (only for BUILD_STRATEGY=latex): +# Build a .pstex_t file from a .fig file. +# +# FEATURES: +# +# Optional Binary Directory: +# If you create the _out_ directory in the same place as the makefile, +# it will automatically be used as a dumping ground for .pdf (or .dvi, +# .ps, and .pdf) output files. +# +# Alternatively, you can set the BINARY_TARGET_DIR variable, either as a +# make argument or in Makefile.ini, to point to your directory of +# choice. Note that no pathname wildcard expansion is done in the +# makefile, so make sure that the path is complete before going in +# there. E.g., if you want to specify something in your home directory, +# use $$HOME/ instead of ~/ so that the shell expands it before it gets +# to the makefile. +# +# External Program Dependencies: +# Every external program used by the makefile is represented by an +# ALLCAPS variable at the top of this file. This should allow you to +# make judgments about whether your system supports the use of this +# makefile. The list is available in the ALL_PROGRAMS variable and, +# provided that you are using GNU make 3.80 or later (or you haven't +# renamed this file to something weird like "mylatexmakefile" and like +# invoking it with make -f) can be viewed using +# +# make _all_programs +# +# Additionally, the availability of these programs can be checked +# automatically for you by running +# +# make _check_programs +# +# The programs are categorized according to how important they are and +# what function they perform to help you decide which ones you really +# need. +# +# Colorized Output: +# The output of commands is colorized to highlight things that are often +# important to developers. This includes {underfull,overfull} +# {h,v}boxes, general LaTeX Errors, each stage of document building, and +# the number of pages in the final document. The colors are obtained +# using 'tput', so colorization should work pretty well on any terminal. +# +# The colors can be customized very simply by setting any of the +# LATEX_COLOR_ variables in your environment (see above). +# +# Predecessors to TeX Files: +# Given a target , if no .tex file exists but a +# corresponding script or predecessor file exists, then appropriate +# action will be taken to generate the tex file. +# +# Currently supported script or predecessor languages are: +# +# sh: %.tex.sh +# perl: %.tex.pl +# python: %.tex.py +# +# Calls the script using the appropriate interpreter, assuming that +# its output is a .tex file. +# +# The script is called thus: +# +#