r3645 - in trunk/tools/ImgToMap: . nbproject nbproject/configs src/imgtomap

savagex at icculus.org savagex at icculus.org
Thu May 22 13:08:51 EDT 2008


Author: savagex
Date: 2008-05-22 13:08:49 -0400 (Thu, 22 May 2008)
New Revision: 3645

Added:
   trunk/tools/ImgToMap/master.jnlp
   trunk/tools/ImgToMap/nbproject/configs/
   trunk/tools/ImgToMap/nbproject/configs/JWS_generated.properties
   trunk/tools/ImgToMap/nbproject/jnlp-impl.xml
Modified:
   trunk/tools/ImgToMap/nbproject/build-impl.xml
   trunk/tools/ImgToMap/nbproject/genfiles.properties
   trunk/tools/ImgToMap/nbproject/project.properties
   trunk/tools/ImgToMap/src/imgtomap/MapWriter.java
Log:
create skyfills in the same way as visblockers are generated - saves tons of brushes.

Also mess with jnlp stuff I don't understand. This is mostly to make div0 happy, who loves Java and is especially keen to see Java WebStart(tm) everywhere.

Added: trunk/tools/ImgToMap/master.jnlp
===================================================================
--- trunk/tools/ImgToMap/master.jnlp	                        (rev 0)
+++ trunk/tools/ImgToMap/master.jnlp	2008-05-22 17:08:49 UTC (rev 3645)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jnlp spec="1.0+" codebase="${jnlp.codebase}" href="launch.jnlp">
+    <information>
+        <title>${APPLICATION.TITLE}</title>
+        <vendor>${APPLICATION.VENDOR}</vendor>
+        <homepage href="${APPLICATION.HOMEPAGE}"/>
+        <description>${APPLICATION.DESC}</description>
+        <description kind="short">${APPLICATION.DESC.SHORT}</description>
+<!--${JNLP.ICONS}-->
+<!--${JNLP.OFFLINE.ALLOWED}-->
+    </information>
+<!--${JNLP.SECURITY}-->
+    <resources>
+<!--${JNLP.RESOURCES.RUNTIME}-->
+<!--${JNLP.RESOURCES.MAIN.JAR}-->
+<!--${JNLP.RESOURCES.JARS}-->
+    </resources>
+    <application-desc main-class="${jnlp.main.class}">
+<!--${JNLP.APPLICATION.ARGS}-->
+    </application-desc>
+</jnlp>

Modified: trunk/tools/ImgToMap/nbproject/build-impl.xml
===================================================================
--- trunk/tools/ImgToMap/nbproject/build-impl.xml	2008-05-22 16:24:45 UTC (rev 3644)
+++ trunk/tools/ImgToMap/nbproject/build-impl.xml	2008-05-22 17:08:49 UTC (rev 3645)
@@ -20,6 +20,7 @@
 
         -->
 <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="ImgToMap-impl">
+    <import file="jnlp-impl.xml"/>
     <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
     <!-- 
                 ======================
@@ -409,7 +410,7 @@
         <!-- Empty placeholder for easier customization. -->
         <!-- You can override this target in the ../build.xml file. -->
     </target>
-    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar,jnlp" description="Build JAR." name="jar"/>
     <!--
                 =================
                 EXECUTION SECTION

Added: trunk/tools/ImgToMap/nbproject/configs/JWS_generated.properties
===================================================================
--- trunk/tools/ImgToMap/nbproject/configs/JWS_generated.properties	                        (rev 0)
+++ trunk/tools/ImgToMap/nbproject/configs/JWS_generated.properties	2008-05-22 17:08:49 UTC (rev 3645)
@@ -0,0 +1,4 @@
+#Thu May 22 18:35:34 CEST 2008
+$label=Web Start
+$target.debug=jws-debug
+$target.run=jws-run

Modified: trunk/tools/ImgToMap/nbproject/genfiles.properties
===================================================================
--- trunk/tools/ImgToMap/nbproject/genfiles.properties	2008-05-22 16:24:45 UTC (rev 3644)
+++ trunk/tools/ImgToMap/nbproject/genfiles.properties	2008-05-22 17:08:49 UTC (rev 3645)
@@ -4,5 +4,5 @@
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
 nbproject/build-impl.xml.data.CRC32=a4571390
-nbproject/build-impl.xml.script.CRC32=f2b42767
+nbproject/build-impl.xml.script.CRC32=00daec73
 nbproject/build-impl.xml.stylesheet.CRC32=487672f9

Added: trunk/tools/ImgToMap/nbproject/jnlp-impl.xml
===================================================================
--- trunk/tools/ImgToMap/nbproject/jnlp-impl.xml	                        (rev 0)
+++ trunk/tools/ImgToMap/nbproject/jnlp-impl.xml	2008-05-22 17:08:49 UTC (rev 3645)
@@ -0,0 +1,461 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+
+
+The contents of this file are subject to the terms of either the GNU
+General Public License Version 2 only ("GPL") or the Common
+Development and Distribution License("CDDL") (collectively, the
+"License"). You may not use this file except in compliance with the
+License. You can obtain a copy of the License at
+http://www.netbeans.org/cddl-gplv2.html
+or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+specific language governing permissions and limitations under the
+License.  When distributing the software, include this License Header
+Notice in each file and include the License file at
+nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
+particular file as subject to the "Classpath" exception as provided
+by Sun in the GPL Version 2 section of the License file that
+accompanied this code. If applicable, add the following below the
+License Header, with the fields enclosed by brackets [] replaced by
+your own identifying information:
+"Portions Copyrighted [year] [name of copyright owner]"
+
+Contributor(s):
+
+The Original Software is NetBeans. The Initial Developer of the Original
+Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+Microsystems, Inc. All Rights Reserved.
+
+If you wish your version of this file to be governed by only the CDDL
+or only the GPL Version 2, indicate your decision by adding
+"[Contributor] elects to include this software in this distribution
+under the [CDDL or GPL Version 2] license." If you do not indicate a
+single choice of license, a recipient has the option to distribute
+your version of this file under either the CDDL, the GPL Version 2 or
+to extend the choice of license to its licensees as provided above.
+However, if you add GPL Version 2 code and therefore, elected the GPL
+Version 2 license, then the option applies only if the new code is
+made subject to such option by the copyright holder.
+-->
+
+<project name="jnlp-impl" default="default" basedir="..">
+
+    <property name="master.jnlp.file" location="master.jnlp"/>
+    <property name="launch.jnlp.file" value="launch.jnlp"/>
+    <property name="jnlp.dest.dir" location="dist"/>
+    
+    <!-- helper file to create list of arguments, etc. -->
+    <property name="helper.file" location="helper.txt"/>
+    
+    <target name="default">
+        <echo message="Default target is not set."/>
+    </target>
+    
+    <!-- Main target -->
+    
+    <target name="jnlp" depends="-init-check,-test-jnlp-enabled" if="is.jnlp.enabled">
+        <delete file="dist/lib/javaws.jar" failonerror="false"/>
+        <antcall target="generate-jnlp"/>
+    </target>
+    
+    <!-- Generate master -->
+    
+    <target name="-check-for-master.jnlp">
+        <available file="${master.jnlp.file}" property="master.jnlp.exists"/>
+    </target>
+    <target name="jnlp-init-generate-master" depends="-check-for-master.jnlp" unless="master.jnlp.exists">
+        <echo file="${master.jnlp.file}" encoding="UTF-8"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<jnlp spec="1.0+" codebase="$${jnlp.codebase}" href="launch.jnlp">
+    <information>
+        <title>$${APPLICATION.TITLE}</title>
+        <vendor>$${APPLICATION.VENDOR}</vendor>
+        <homepage href="$${APPLICATION.HOMEPAGE}"/>
+        <description>$${APPLICATION.DESC}</description>
+        <description kind="short">$${APPLICATION.DESC.SHORT}</description>
+<!--$${JNLP.ICONS}-->
+<!--$${JNLP.OFFLINE.ALLOWED}-->
+    </information>
+<!--$${JNLP.SECURITY}-->
+    <resources>
+<!--$${JNLP.RESOURCES.RUNTIME}-->
+<!--$${JNLP.RESOURCES.MAIN.JAR}-->
+<!--$${JNLP.RESOURCES.JARS}-->
+    </resources>
+    <application-desc main-class="$${jnlp.main.class}">
+<!--$${JNLP.APPLICATION.ARGS}-->
+    </application-desc>
+</jnlp>
+]]></echo>
+    </target>
+    
+    <!-- Initial check -->
+    
+    <target name="-init-check">
+        <fail unless="application.title" message="Must set application title."/>
+        <fail unless="application.vendor" message="Must set application vendor."/>
+    </target>
+    
+    <!-- Icons -->
+    
+    <target name="-init-icons" depends="-preinit-icons,-set-icon-elem,-set-splash-elem">
+        <property name="jnlp.icon.elem" value=""/>
+        <property name="application.splash.elem" value=""/>
+        <property name="icon.separator" value=""/>
+        <property name="jnlp.icons.value" value="${jnlp.icon.elem}${icon.separator}${application.splash.elem}"/>
+    </target>
+    <target name="-preinit-icons" depends="-copy-app-icon,-copy-app-splash"/>
+    <target name="-copy-app-icon" if="jnlp.icon" depends="-get-app-icon-name">
+        <copy file="${jnlp.icon}" todir="${jnlp.dest.dir}" failonerror="false"/>
+        <available file="${jnlp.dest.dir}${file.separator}${jnlp.icon.name}" property="jnlp.icon.copied"/>
+    </target>
+    <target name="-copy-app-splash" if="application.splash" depends="-get-app-splash-name">
+        <copy file="${application.splash}" todir="${jnlp.dest.dir}" failonerror="false"/>
+        <available file="${jnlp.dest.dir}${file.separator}${application.splash.name}" property="application.splash.copied"/>
+    </target>
+    <target name="-get-app-icon-name" if="jnlp.icon">
+        <dirname file="${jnlp.icon}" property="jnlp.icon.basedir"/>
+        <pathconvert property="jnlp.icon.name" setonempty="false">
+            <path location="${jnlp.icon}"/>
+            <map from="${jnlp.icon.basedir}${file.separator}" to=""/>
+        </pathconvert>
+    </target>
+    <target name="-get-app-splash-name" if="application.splash">
+        <dirname file="${application.splash}" property="application.splash.basedir"/>
+        <pathconvert property="application.splash.name" setonempty="false">
+            <path location="${application.splash}"/>
+            <map from="${application.splash.basedir}${file.separator}" to=""/>
+        </pathconvert>
+    </target>
+    <target name="-set-icon-elem" if="jnlp.icon.copied">
+        <property name="jnlp.icon.elem" value='        &lt;icon href="${jnlp.icon.name}" kind="default"/&gt;'/>
+    </target>
+    <target name="-set-splash-elem" if="application.splash.copied" depends="-set-icon-elem">
+        <property name="application.splash.elem" value='        &lt;icon href="${application.splash.name}" kind="splash"/&gt;'/>
+        <condition property="icon.separator" value="${line.separator}">
+            <isset property="jnlp.icon.elem"/>
+        </condition>
+    </target>
+    
+    <!-- Offline-Allowed -->
+    
+    <target name="-init-offline" if="offline.allowed.set" depends="-preinit-offline">
+        <property name="jnlp.offline.allowed.value" value="        &lt;offline-allowed/&gt;"/>
+    </target>
+    <target name="-preinit-offline">
+        <condition property="offline.allowed.set">
+            <equals arg1="${jnlp.offline-allowed}" arg2="true" trim="true"/>
+        </condition>
+    </target>
+    
+    <!-- Descriptions -->
+    
+    <target name="-init-descriptions" depends="-descriptions-props-check,-init-desc-value,-init-desc-value-short">
+        <property name="application.desc.value" value="${application.title}"/>
+        <property name="application.desc.short.value" value="${application.title}"/>
+    </target>
+    <target name="-descriptions-props-check">
+        <condition property="application.desc.set">
+            <and>
+                <isset property="application.desc"/>
+                <not>
+                    <equals arg1="${application.desc}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="application.desc.short.set">
+            <and>
+                <isset property="application.desc.short"/>
+                <not>
+                    <equals arg1="${application.desc.short}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+    </target>
+    <target name="-init-desc-value" if="application.desc.set">
+        <property name="application.desc.value" value="${application.desc}"/>
+    </target>
+    <target name="-init-desc-value-short" if="application.desc.short.set">
+        <property name="application.desc.short.value" value="${application.desc.short}"/>
+    </target>
+    
+    <!-- Security -->
+    
+    <target name="-init-security" depends="-check-signing-possible" if="jnlp.signed.true+signjarstask.available">
+        <property name="jnlp.security" value="    &lt;security&gt;${line.separator}        &lt;all-permissions/&gt;${line.separator}    &lt;/security&gt;"/>
+    </target>
+    <target name="-security-props-check">
+        <condition property="jnlp.signed.true">
+            <istrue value="${jnlp.signed}"/>
+        </condition>
+    </target>
+    <target name="-jnlp-init-keystore" depends="-jnlp-init-keystore-props,-check-keystore-exists" unless="jnlp.signjar.keystore.exists">
+        <echo message="${application.vendor}" file="${helper.file}"/>
+        <loadfile property="application.vendor.filtered" srcfile="${helper.file}">
+            <filterchain>
+                <deletecharacters chars=","/>
+            </filterchain>
+        </loadfile>
+        <delete file="${helper.file}"/>
+        <property name="jnlp.signjar.vendor" value="CN=${application.vendor.filtered}"/>
+        <echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
+        <genkey dname="${jnlp.signjar.vendor}" alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}"
+            storepass="${jnlp.signjar.storepass}" keypass="${jnlp.signjar.keypass}"/>
+    </target>
+    <target name="-check-keystore-exists">
+        <available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
+    </target>
+    <target name="-jnlp-init-keystore-props">
+        <property name="jnlp.signjar.keystore" value="${basedir}/build/nb-jws.ks"/>
+        <property name="jnlp.signjar.storepass" value="storepass"/>
+        <property name="jnlp.signjar.keypass" value="keypass"/>
+        <property name="jnlp.signjar.alias" value="nb-jws"/>
+    </target>    
+    
+    <!-- Generating JNLP file -->
+    
+    <target name="generate-jnlp" depends="jnlp-init-generate-master,-init-codebase,-init-resources-runtime,-init-security,-init-resources-jars,-init-application-args,-init-icons,-init-offline,-init-descriptions,jnlp-init-notinited">
+        <copy file="${master.jnlp.file}" tofile="${jnlp.dest.dir}/${launch.jnlp.file}__" overwrite="true" encoding="UTF-8">
+            <filterchain>
+                <replacestring from="$${jnlp.codebase}" to="${jnlp.codebase.value}"/>
+                <replacestring from="&lt;!--$${JNLP.ICONS}--&gt;" to="${jnlp.icons.value}"/>
+                <replacestring from="&lt;!--$${JNLP.SECURITY}--&gt;" to="${jnlp.security}"/>
+                <replacestring from="&lt;!--$${JNLP.OFFLINE.ALLOWED}--&gt;" to="${jnlp.offline.allowed.value}"/>
+                <replacestring from="&lt;!--$${JNLP.RESOURCES.RUNTIME}--&gt;" to="${jnlp.resources.runtime.value}"/>
+                <replacestring from="&lt;!--$${JNLP.RESOURCES.MAIN.JAR}--&gt;" to="${jnlp.resources.main.jar.value}"/>
+                <replacestring from="&lt;!--$${JNLP.RESOURCES.JARS}--&gt;" to="${jnlp.resources.jars.value}"/>
+                <replacestring from="&lt;!--$${JNLP.APPLICATION.ARGS}--&gt;" to="${jnlp.application.args.value}"/>
+                <replacestring from="$${APPLICATION.TITLE}" to="${application.title}"/>
+                <replacestring from="$${APPLICATION.VENDOR}" to="${application.vendor}"/>
+                <replacestring from="$${APPLICATION.DESC}" to="${application.desc.value}"/>
+                <replacestring from="$${APPLICATION.DESC.SHORT}" to="${application.desc.short.value}"/>
+                <replacestring from="$${APPLICATION.HOMEPAGE}" to="${application.homepage}"/>
+                <replacestring from="$${jnlp.main.class}" to="${main.class}"/>
+            </filterchain>
+        </copy>
+        <antcall target="-strip-empty-lines"/>
+        <antcall target="-generate-html-page"/>
+    </target>
+    <target name="jnlp-init-notinited">
+        <property name="jnlp.security" value=""/>
+        <property name="jnlp.offline.allowed.value" value=""/>
+        <property name="application.homepage" value=""/>
+        <property name="jnlp.application.args.value" value=""/>
+    </target>
+    <target name="-strip-empty-lines">
+        <move file="${jnlp.dest.dir}/${launch.jnlp.file}__" tofile="${jnlp.dest.dir}/${launch.jnlp.file}" overwrite="true" encoding="UTF-8">
+            <filterchain>
+                <linecontainsregexp>
+                    <regexp pattern=".+"/>
+                </linecontainsregexp>
+            </filterchain>
+        </move>
+    </target>
+    
+    <!-- Codebase processing -->
+    
+    <target name="-init-codebase" depends="-codebase-props-check,-init-non-user-codebase,-init-user-codebase"/>
+    <target name="-codebase-props-check">
+        <condition property="local.codebase">
+            <or>
+                <not>
+                    <isset property="jnlp.codebase.type"/>
+                </not>
+                <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
+            </or>
+        </condition>
+        <condition property="non.user.codebase">
+            <or>
+                <not>
+                    <isset property="jnlp.codebase.type"/>
+                </not>
+                <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
+                <equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/>
+            </or>
+        </condition>
+        <condition property="user.codebase">
+            <equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/>
+        </condition>
+    </target>
+    <target name="-init-non-user-codebase" if="non.user.codebase">
+        <property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/>
+    </target>
+    <target name="-init-user-codebase" if="user.codebase">
+        <property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/>
+    </target>
+    
+    <!-- j2se resources -->
+    
+    <target name="-init-resources-runtime" depends="-init-runtime-props">
+        <property name="run.jvmargs.value" value=""/>
+        <property name="initial-heap-size.value" value=""/>
+        <property name="max-heap-size.value" value=""/>
+        <property name="jnlp.resources.runtime.value" 
+            value='        &lt;j2se version="${javac.target}+"${initial-heap-size.value}${max-heap-size.value}${run.jvmargs.value}/&gt;'/>
+    </target>
+    <target name="-init-runtime-props" depends="-runtime-props-check,-init-run-jvmargs-value,-init-initial-heap-size-value,-init-max-heap-size-value"/>
+    <target name="-runtime-props-check">
+        <condition property="run.jvmargs.set">
+            <and>
+                <isset property="run.jvmargs"/>
+                <not>
+                    <equals arg1="${run.jvmargs}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="jnlp.initial-heap-size.set">
+            <and>
+                <isset property="jnlp.initial-heap-size"/>
+                <not>
+                    <equals arg1="${jnlp.initial-heap-size}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="jnlp.max-heap-size.set">
+            <and>
+                <isset property="jnlp.max-heap-size"/>
+                <not>
+                    <equals arg1="${jnlp.max-heap-size}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+    </target>
+    <target name="-init-run-jvmargs-value" if="run.jvmargs.set">
+        <property name="run.jvmargs.value" value=' java-vm-args="${run.jvmargs}"'/>
+    </target>
+    <target name="-init-initial-heap-size-value" if="jnlp.initial-heap-size.set">
+        <property name="initial-heap-size.value" value=' initial-heap-size="${jnlp.initial-heap-size}"'/>
+    </target>
+    <target name="-init-max-heap-size-value" if="jnlp.max-heap-size.set">
+        <property name="max-heap-size.value" value=' max-heap-size="${jnlp.max-heap-size}"'/>
+    </target>
+    
+    <!-- JAR resources -->
+    
+    <target name="-init-resources-jars" depends="-preinit-resources-unsigned-jars,-preinit-resources-signed-jars,-preinit-resources-main-jar"/>
+    <target name="-preinit-resources-unsigned-jars" depends="-exclude-javaws-from-cp,-check-signing-possible" unless="jnlp.signed.true+signjarstask.available">
+        <pathconvert pathsep="${line.separator}" property="jnlp.resources.jars.value">
+            <path path="${run.classpath.without.javaws.jar}"/>
+            <mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
+                to='        &lt;jar href="lib/\1" download="eager"/&gt;'/>
+        </pathconvert>
+    </target>
+    <target name="-preinit-resources-main-jar">
+        <pathconvert pathsep="${line.separator}" property="jnlp.resources.main.jar.value">
+            <path location="${dist.jar}"/>
+            <mapper type="regexp" from="^.*[/\\]([^/\\]+\.jar)"
+                to='        &lt;jar href="\1" main="true" download="eager"/&gt;'/>
+        </pathconvert>
+    </target>
+    <target name="-exclude-javaws-from-cp">
+        <pathconvert property="path.element.to.be.removed">
+            <path path="${run.classpath}"/>
+            <mapper type="regexp" from="(^.*[/\\]javaws.jar)" to="\1"/>
+        </pathconvert>
+        <pathconvert property="run.classpath.without.javaws.jar">
+            <path path="${run.classpath}"/>
+            <map from="${path.element.to.be.removed}" to=""/>
+        </pathconvert>
+    </target>
+    <target name="-check-task-available">
+        <condition property="signjarstask.available">
+            <isset property="netbeans.home"/>
+        </condition>
+    </target>
+    <target name="-check-signing-possible" depends="-security-props-check,-check-task-available">
+        <condition property="jnlp.signed.true+signjarstask.available">
+            <and>
+                <isset property="jnlp.signed.true"/>
+                <isset property="signjarstask.available"/>
+            </and>
+        </condition>
+    </target>
+    <target name="-unavailable-task-warning" depends="-check-task-available" unless="signjarstask.available">
+        <echo message="Signtask is not available, jar files will not be signed. Task is available only when running inside NetBeans IDE."/>
+        <echo message="You can fix the problem by adding following jar file to Ant classpath: [NetBeans install dir]/java2/ant/nblib/org-netbeans-modules-javawebstart-signtask.jar"/>
+    </target>
+    <target name="-preinit-resources-signed-jars" depends="-unavailable-task-warning,-sign-jars" if="jnlp.signed.true+signjarstask.available">
+        <property name="jnlp.resources.jars.value" value="${jnlp.signed.jars}${jnlp.components}"/>
+    </target>
+    <target name="-sign-jars" depends="-jnlp-init-keystore,-check-signing-possible" if="jnlp.signed.true+signjarstask.available">
+        <jnlpsignjars keystore="${jnlp.signjar.keystore}" storepass="${jnlp.signjar.storepass}" 
+                keypass="${jnlp.signjar.keypass}" alias="${jnlp.signjar.alias}" mainjar="${dist.jar}" destdir="dist"
+                codebase="${jnlp.codebase.value}" signedjarsprop="jnlp.signed.jars"
+                componentsprop="jnlp.components">
+            <fileset dir="dist/lib">
+                <include name="*.jar"/>
+            </fileset>
+        </jnlpsignjars>
+    </target>
+    
+    <!-- Application arguments -->
+    
+    <target name="-init-application-args" if="application.args">
+        <echo message="${application.args}" file="${helper.file}"/>
+        <loadfile srcfile="${helper.file}" property="jnlp.application.args.value">
+            <filterchain>
+                <tokenfilter delimoutput="\n">
+                    <stringtokenizer/>
+                    <replaceregex pattern="(.+)" replace="        &lt;argument&gt;\1&lt;/argument&gt;"/>
+                </tokenfilter>
+            </filterchain>
+        </loadfile>
+        <delete file="${helper.file}"/>
+    </target>
+    
+    <!-- Running/Debugging -->
+    
+    <target name="jws-run" depends="jar,-verify-jnlp-enabled,-verify-codebase" description="Start javaws execution">
+        <exec executable="${java.home}/bin/javaws">
+            <arg file="${jnlp.dest.dir}/${launch.jnlp.file}"/>
+        </exec>
+    </target>
+    <target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee" 
+        description="Debug javaws project in IDE"/>
+    <target name="-debug-javaws-debuggee">
+        <exec executable="${java.home}/bin/javaws">
+            <env key="JAVAWS_VM_ARGS" value="-Xdebug -Xnoagent -Djava.compiler=none -Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+            <arg file="${jnlp.dest.dir}/${launch.jnlp.file}"/>
+        </exec>
+    </target>
+    <target name="-verify-codebase" depends="-codebase-props-check" unless="local.codebase">
+        <fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution."/>
+    </target>
+    <target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled">
+        <fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/>
+    </target>
+    
+    <!-- Test JNLP enabled-->
+    
+    <target name="-test-jnlp-enabled">
+        <condition property="is.jnlp.enabled">
+            <equals arg1="${jnlp.enabled}" arg2="true" casesensitive="false" trim="true"/>
+        </condition>
+    </target>
+    
+    <!-- Generate simple HTML test page -->
+    
+    <target name="-generate-html-page">
+        <echo file="${jnlp.dest.dir}/launch.html"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+    <head>
+        <title>Test page for launching the application via JNLP</title>
+    </head>
+    <body>
+        <h3>Test page for launching the application via JNLP</h3>
+        <a href="launch.jnlp">Launch the application</a>
+        <!-- or use following script element to launch via Deployment Toolkit
+        <script src="http://java.com/js/deployJava.js"></script>
+        <script>
+            var url="http://[fill in your URL]/launch.jnlp";
+            deployJava.createWebStartLaunchButton(url, "1.6");
+        </script>
+        -->
+    </body>
+</html>
+]]></echo>
+    </target>
+    
+</project>

Modified: trunk/tools/ImgToMap/nbproject/project.properties
===================================================================
--- trunk/tools/ImgToMap/nbproject/project.properties	2008-05-22 16:24:45 UTC (rev 3644)
+++ trunk/tools/ImgToMap/nbproject/project.properties	2008-05-22 17:08:49 UTC (rev 3645)
@@ -43,6 +43,11 @@
 javadoc.use=true
 javadoc.version=false
 javadoc.windowtitle=
+jnlp.codebase.type=local
+jnlp.codebase.url=file:/mnt/data/nexuizsvn/nexuiz/trunk/tools/ImgToMap/dist/
+jnlp.enabled=false
+jnlp.offline-allowed=false
+jnlp.signed=false
 main.class=imgtomap.Main
 manifest.file=manifest.mf
 meta.inf.dir=${src.dir}/META-INF

Modified: trunk/tools/ImgToMap/src/imgtomap/MapWriter.java
===================================================================
--- trunk/tools/ImgToMap/src/imgtomap/MapWriter.java	2008-05-22 16:24:45 UTC (rev 3644)
+++ trunk/tools/ImgToMap/src/imgtomap/MapWriter.java	2008-05-22 17:08:49 UTC (rev 3645)
@@ -96,21 +96,26 @@
             }
         }
 
+        double xmax = (columns.length - 1) * units;
+        double ymax = (columns[0].length - 1) * units;
+
+
         if (p.skyfill) {
-            for (int x = 0; x < columns.length; ++x) {
-                for (int y = 0; y < columns[0].length; ++y) {
-                    if (columns[x][y] < 0) {
-                        // this is a skipped block, see if it neighbours a
-                        // relevant block
-                        double tmp = getMinMaxForRegion(columns, x - 1, y - 1, 3)[1];
-                        if (tmp >= 0) {
-                            Vector3D p1 = new Vector3D(x * units, -(y + 1) * units, -32.0);
-                            Vector3D p2 = new Vector3D((x + 1) * units, -y * units, p.skyheight);
+            List<Block> fillers = genSkyFillers(columns);
+            for (Block b : fillers) {
+                double x = b.x * units;
+                double y = (b.y + b.ydim) * units;
+                x = x > xmax ? xmax : x;
+                y = y > ymax ? ymax : y;
+                Vector3D p1 = new Vector3D(x, -y, -32.0);
 
-                            writeBoxBrush(pw, p1, p2, false, p.skytexture, 1.0);
-                        }
-                    }
-                }
+                x = (b.x + b.xdim) * units;
+                y = b.y * units;
+                x = x > xmax ? xmax : x;
+                y = y > ymax ? ymax : y;
+                Vector3D p2 = new Vector3D(x, -y, p.skyheight);
+
+                writeBoxBrush(pw, p1, p2, false, p.skytexture, 1.0);
             }
         }
 
@@ -155,11 +160,9 @@
         // genBlockers screws the columns array!
         // this should be the last step!
         if (p.visblockers) {
-            List<VisBlocker> blockers = genBlockers(columns, 0.15);
-            double xmax = (columns.length - 1) * units;
-            double ymax = (columns[0].length - 1) * units;
-            for (VisBlocker b : blockers) {
-                double z = b.minheight * p.height;
+            List<Block> blockers = genBlockers(columns, 0.15);
+            for (Block b : blockers) {
+                double z = b.minheight * p.height - 1;
                 z = Math.floor(z / 16);
                 z = z * 16;
 
@@ -309,16 +312,16 @@
         return result;
     }
 
-    public List<VisBlocker> genBlockers(double[][] columns, double delta) {
+    private List<Block> genBlockers(double[][] columns, double delta) {
 
-        VisBlocker[][] blockers = new VisBlocker[columns.length][columns[0].length];
-        LinkedList<VisBlocker> result = new LinkedList<VisBlocker>();
+        Block[][] blockers = new Block[columns.length][columns[0].length];
+        LinkedList<Block> result = new LinkedList<Block>();
 
         for (int x = 0; x < columns.length; ++x) {
             for (int y = 0; y < columns[0].length; ++y) {
                 if (blockers[x][y] == null && columns[x][y] >= 0) {
                     // this pixel isn't covered by a blocker yet... so let's create one!
-                    VisBlocker b = new VisBlocker();
+                    Block b = new Block();
                     result.add(b);
                     b.x = x;
                     b.y = y;
@@ -377,9 +380,92 @@
         return result;
     }
 
+    private List<Block> genSkyFillers(double[][] columns) {
+
+        double delta = 0;
+
+        for (int x = 0; x < columns.length; ++x) {
+            for (int y = 0; y < columns[0].length; ++y) {
+                if (columns[x][y] < 0) {
+                    // this is a skipped block, see if it neighbours a
+                    // relevant block
+                    if (getMinMaxForRegion(columns, x - 1, y - 1, 3)[1] >= 0) {
+                        columns[x][y] = -100d;
+                    }
+                }
+            }
+        }
+
+
+        Block[][] fillers = new Block[columns.length][columns[0].length];
+        LinkedList<Block> result = new LinkedList<Block>();
+
+        for (int x = 0; x < columns.length; ++x) {
+            for (int y = 0; y < columns[0].length; ++y) {
+                if (fillers[x][y] == null && columns[x][y] == -100d) {
+                    // this pixel is marked to be skyfill
+                    Block b = new Block();
+                    result.add(b);
+                    b.x = x;
+                    b.y = y;
+                    b.minheight = b.origheight = columns[x][y];
+
+                    // grow till the delta hits
+                    int xdim = 1;
+                    int ydim = 1;
+                    boolean xgrow = true;
+                    boolean ygrow = true;
+                    double min = b.minheight;
+                    for (; xdim < columns.length && ydim < columns[0].length;) {
+                        double[] minmax = getMinMaxForRegion(columns, x, y, xdim + 1, ydim);
+                        if (Math.abs(b.origheight - minmax[0]) > delta || Math.abs(b.origheight - minmax[1]) > delta) {
+                            xgrow = false;
+                        }
+
+                        minmax = getMinMaxForRegion(columns, x, y, xdim, ydim + 1);
+                        if (Math.abs(b.origheight - minmax[0]) > delta || Math.abs(b.origheight - minmax[1]) > delta) {
+                            ygrow = false;
+                        }
+
+                        min = minmax[0];
+
+                        if (xgrow) {
+                            ++xdim;
+                        }
+                        if (ygrow) {
+                            ++ydim;
+                        }
+
+                        minmax = getMinMaxForRegion(columns, x, y, xdim, ydim);
+                        min = minmax[0];
+
+                        if (!(xgrow || ygrow)) {
+                            break;
+                        }
+                    }
+
+                    b.xdim = xdim;
+                    b.ydim = ydim;
+                    b.minheight = min;
+
+                    for (int i = x; i < x + b.xdim; ++i) {
+                        for (int j = y; j < y + b.ydim; ++j) {
+                            if (i >= 0 && j >= 0 && i < fillers.length && j < fillers[0].length) {
+                                fillers[i][j] = b;
+                                columns[i][j] = -1337.0;
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+        return result;
+    }
+
     private class Vector3D {
 
-        public  double x,    y,    z;
+        public double x,  y,  z;
 
         public Vector3D() {
             this(0.0, 0.0, 0.0);
@@ -434,9 +520,9 @@
         }
     }
 
-    private class VisBlocker {
+    private class Block {
 
-        public  int x,    y,    xdim,   ydim;
-        public  double origheight,    minheight;
+        public int x,  y,  xdim,  ydim;
+        public double origheight,  minheight;
     }
 }
\ No newline at end of file




More information about the nexuiz-commits mailing list