changeset 2496:7e077899e259

Added dependency to MapFish Print flys-client/trunk@4309 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 26 Apr 2012 11:32:57 +0000
parents d0066abb025c
children a6c6f305546c
files flys-client/ChangeLog flys-client/pom.xml flys-client/src/main/webapp/WEB-INF/config.yaml flys-client/src/main/webapp/WEB-INF/web.xml
diffstat 4 files changed, 223 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Apr 26 09:52:17 2012 +0000
+++ b/flys-client/ChangeLog	Thu Apr 26 11:32:57 2012 +0000
@@ -1,3 +1,13 @@
+2012-04-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml: Added dependency to MapFish Print (http://www.mapfish.org/doc/print/)
+	  License GPLv3. (This is okay, because we only use it via out-of-process calls).
+
+	* src/main/webapp/WEB-INF/web.xml: Added servlet and servlet mapping.
+
+	* src/main/webapp/WEB-INF/config.yaml: New. Just copied from MapFish config examples.
+	  TODO: Adjust for out use case.
+
 2012-04-26	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
--- a/flys-client/pom.xml	Thu Apr 26 09:52:17 2012 +0000
+++ b/flys-client/pom.xml	Thu Apr 26 11:32:57 2012 +0000
@@ -89,6 +89,11 @@
       <artifactId>log4j</artifactId>
       <version>1.2.14</version>
     </dependency>
+    <dependency>
+      <groupId>org.mapfish.print</groupId>
+      <artifactId>print-lib</artifactId>
+      <version>1.2-SNAPSHOT</version>
+    </dependency>
   </dependencies>
   
   <build>
@@ -186,6 +191,10 @@
            <name>SmartGWT</name>
            <url>http://www.smartclient.com/maven2</url>
       </repository>
+      <repository>
+        <id>org.mapfish</id>
+        <url>http://dev.mapfish.org/maven/repository</url>
+      </repository>
     </repositories>
 </project>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/config.yaml	Thu Apr 26 11:32:57 2012 +0000
@@ -0,0 +1,190 @@
+#===========================================================================
+# allowed DPIs
+#===========================================================================
+dpis: [254, 190, 127, 56]
+
+#===========================================================================
+# allowed Formats
+#===========================================================================
+formats: ['*']
+
+#===========================================================================
+# the allowed scales
+#===========================================================================
+scales:
+  - 25000
+  - 50000
+  - 100000
+  - 200000
+  - 500000
+  - 1000000
+  - 2000000
+  - 4000000
+
+outputFilename: 'pigma-${date}.pdf'
+
+#===========================================================================
+# the list of allowed hosts
+#===========================================================================
+hosts:
+  - !localMatch
+    dummy: true
+  - !ipMatch
+    ip: www.camptocamp.org
+  - !dnsMatch
+    host: labs.metacarta.com
+    port: 80
+  - !dnsMatch
+    host: terraservice.net
+    port: 80
+  - !dnsMatch
+    host: tile.openstreetmap.org
+    port: 80
+
+security:
+  - !basicAuth
+    matcher: !dnsMatch
+      host: c2cpc61.camptocamp.com
+      port:80
+    username: xyz
+    password: yxz
+    preemptive: true
+
+
+layouts:
+  #===========================================================================
+  A4 portrait:
+  #===========================================================================
+    metaData:
+      title: '${title}'
+      author: 'MapFish print module'
+      subject: 'Simple layout'
+      keywords: 'map,print'
+      creator: 'MapFish'
+
+    titlePage:
+      pageSize: A4
+      items:
+        - !text
+          spacingAfter: 150
+        - !text
+          font: Helvetica
+          fontSize: 40
+          spacingAfter: 100
+          align: center
+          text: '${title}'
+        - !image
+          maxWidth: 160
+          maxHeight: 160
+          spacingAfter: 100
+          align: center
+          url: http://trac.mapfish.org/trac/mapfish/attachment/ticket/3/logo_v8_sphere.svg?format=raw
+        - !image
+          maxWidth: 160
+          maxHeight: 160
+          spacingAfter: 100
+          align: center
+          url: 'file://${configDir}/logo-camptocamp-transparent.png'
+        - !text
+          font: Helvetica
+          fontSize: 14
+          align: left
+          text: |
+            Two layers are asked by the client:
+            - a base layer from Metacarta
+            - a transparent layer from Camptocamp.org (routes)
+            .
+            Some text is added over the map, just to demonstrate the absolute positionning.
+      footer: &commonFooter
+        height: 30
+        items:
+          - !columns
+            config:
+              cells:
+                - paddingBottom: 5   
+            items:
+              - !image
+                maxWidth: 40
+                backgroundColor: #FF0000
+                align: left
+                url: '${configDir}/small-logo-camptocamp.png'
+              - !text
+                backgroundColor: #FF0000
+                text: ©Camptocamp SA
+              - !text
+                align: right
+                text: 'Page ${pageNum}'
+
+    #-------------------------------------------------------------------------
+    mainPage:
+      pageSize: A4
+      rotation: true
+      header:
+        height: 50
+        items:
+          - !text
+            font: Helvetica
+            fontSize: 30
+            align: right
+            text: '${mapTitle}'
+      items:
+        - !map
+          spacingAfter: 30
+          width: 440
+          height: 483
+        - !columns
+          # columns can have an absolute position. In that case, they need the 3 following fields:
+          absoluteX: 410
+          absoluteY: 310
+          width: 100
+          items:
+            - !scalebar
+              type: bar
+              maxSize: 100
+              barBgColor: white
+              fontSize: 8
+              align: right
+        - !text
+          text: '${comment}'
+          spacingAfter: 30
+        - !attributes
+          source: data
+          spacingAfter: 30
+          columnDefs:
+            id:
+              columnWeight: 2
+              header: !text
+                text: ID
+                backgroundColor: #A0A0A0
+              cell: !text
+                text: '${id}'
+            name:
+              columnWeight: 5
+              header: !text
+                text: Name
+                backgroundColor: #A0A0A0
+              cell: !columns
+                config:
+                  cells:
+                    - backgroundColor: '${nameBackgroundColor}'
+                      borderWidth: 1
+                      borderColor: '${nameBorderColor}'
+                items:
+                  - !text
+                    text: '${name}'
+            icon:
+              columnWeight: 2
+              header: !text
+                text: Symbol
+                backgroundColor: #A0A0A0
+              cell: !image
+                align: center
+                maxWidth: 15
+                maxHeight: 15
+                url: 'http://www.mapfish.org/svn/mapfish/framework/client/trunk/mfbase/mapfish/img/${icon}.png'
+        - !text
+          font: Helvetica
+          fontSize: 9
+          align: right
+          text: '1:${scale} ${now MM.dd.yyyy}'
+      footer: *commonFooter
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Thu Apr 26 09:52:17 2012 +0000
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Thu Apr 26 11:32:57 2012 +0000
@@ -423,6 +423,20 @@
     <url-pattern>/flys/fileupload</url-pattern>
   </servlet-mapping>
 
+  <servlet>
+    <servlet-name>mapfish.print</servlet-name>
+    <servlet-class>org.mapfish.print.servlet.MapPrinterServlet</servlet-class>
+    <init-param>
+      <param-name>config</param-name>
+      <param-value>config.yaml</param-value>
+    </init-param>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>mapfish.print</servlet-name>
+    <url-pattern>/flys/map-print</url-pattern>
+  </servlet-mapping>
+
   <!-- Default page to serve -->
   <welcome-file-list>
     <welcome-file>FLYS.html</welcome-file>

http://dive4elements.wald.intevation.org