Skip to content
Commits on Source (2)
SWEET HOME 3D v 6.1a
--------------------
SWEET HOME 3D v 6.1.2
---------------------
This archive contains source code of Sweet Home 3D, an interior design Java application.
Please read http://www.sweethome3d.com/history.html for more information
......@@ -7,7 +7,7 @@ about new features available in this version.
You may also download this source code with the following SVN command:
svn checkout https://svn.code.sf.net/p/sweethome3d/code/tags/V_6_1_A/SweetHome3D SweetHome3D
svn checkout https://svn.code.sf.net/p/sweethome3d/code/tags/V_6_1_2/SweetHome3D SweetHome3D
HOW TO USE THIS SOURCE CODE
......
......@@ -33,7 +33,7 @@
-->
<project basedir="." default="jarExecutable" name="SweetHome3D">
<!-- The current version of Sweet Home 3D -->
<property name="version" value="6.1"/>
<property name="version" value="6.1.2"/>
<target name="build"
description="Builds build/SweetHome3D.jar with all its classes">
......
......@@ -3,11 +3,11 @@
<plist version="0.9">
<dict>
<key>CFBundleGetInfoString</key>
<string>Sweet Home 3D 6.1 Copyright 2007-2019 eTeks</string>
<string>Sweet Home 3D 6.1.2 Copyright 2007-2019 eTeks</string>
<key>CFBundleVersion</key>
<string>6100</string>
<string>6120</string>
<key>CFBundleShortVersionString</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
......@@ -17,7 +17,7 @@
<key>CFBundleIdentifier</key>
<string>com.eteks.sweethome3d.SweetHome3D</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleName</key>
<string>Sweet Home 3D</string>
<key>CFBundlePackageType</key>
......@@ -243,7 +243,7 @@
<key>Properties</key>
<dict>
<key>java.ext.dirs</key>
<string>$JAVAROOT/ext:/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext:/Library/Java/JavaVirtualMachines/1.6.1.jdk/Contents/Home/lib/ext</string>
<string>$JAVAROOT/ext:/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext:/Library/Java/JavaVirtualMachines/1.6.1.2.jdk/Contents/Home/lib/ext</string>
<key>java.library.path</key>
<string>$JAVAROOT/ext</string>
<key>jogamp.gluegen.UseTempJarCache</key>
......
......@@ -3,11 +3,11 @@
<plist version="0.9">
<dict>
<key>CFBundleGetInfoString</key>
<string>Sweet Home 3D 6.1 Copyright 2007-2019 eTeks</string>
<string>Sweet Home 3D 6.1.2 Copyright 2007-2019 eTeks</string>
<key>CFBundleVersion</key>
<string>6100</string>
<string>6120</string>
<key>CFBundleShortVersionString</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
......@@ -17,7 +17,7 @@
<key>CFBundleIdentifier</key>
<string>com.eteks.sweethome3d.SweetHome3D</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleName</key>
<string>Sweet Home 3D</string>
<key>CFBundlePackageType</key>
......
......@@ -3,11 +3,11 @@
<plist version="0.9">
<dict>
<key>CFBundleGetInfoString</key>
<string>Sweet Home 3D 6.1 Copyright 2007-2019 eTeks</string>
<string>Sweet Home 3D 6.1.2 Copyright 2007-2019 eTeks</string>
<key>CFBundleVersion</key>
<string>6100</string>
<string>6120</string>
<key>CFBundleShortVersionString</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
......@@ -17,7 +17,7 @@
<key>CFBundleIdentifier</key>
<string>com.eteks.sweethome3d.SweetHome3D</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.1</string>
<string>6.1.2</string>
<key>CFBundleName</key>
<string>Sweet Home 3D</string>
<key>CFBundlePackageType</key>
......@@ -243,7 +243,7 @@
<key>Properties</key>
<dict>
<key>java.ext.dirs</key>
<string>$APP_PACKAGE/../lib/ext:$APP_PACKAGE/../lib/ext/java3d-1.6:/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext:/Library/Java/JavaVirtualMachines/1.6.1.jdk/Contents/Home/lib/ext</string>
<string>$APP_PACKAGE/../lib/ext:$APP_PACKAGE/../lib/ext/java3d-1.6:/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext:/Library/Java/JavaVirtualMachines/1.6.1.2.jdk/Contents/Home/lib/ext</string>
<key>java.library.path</key>
<string>$APP_PACKAGE/../lib/ext/java3d-1.6/macosx</string>
<key>jogamp.gluegen.UseTempJarCache</key>
......
SWEET HOME 3D v 6.1
-------------------
SWEET HOME 3D v 6.1.2
---------------------
The current folder contains the required applications and data to run Sweet Home 3D
under Windows 32 bits, Windows 64 bits, Mac OS X, Linux 32 bits and Linux 64 bits.
......
......@@ -55,12 +55,12 @@
<opt>-Djava.library.path=lib/ext/java3d-1.6/windows/amd64 -Djogamp.gluegen.UseTempJarCache=false -Dcom.eteks.sweethome3d.preferencesFolder=data -Dcom.eteks.sweethome3d.applicationFolders=data -Dcom.eteks.sweethome3d.deploymentInformation=portable -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Portable</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -53,12 +53,12 @@
<opt>-Djava.library.path=lib/ext/java3d-1.6/windows/i586 -Djogamp.gluegen.UseTempJarCache=false -Dcom.eteks.sweethome3d.preferencesFolder=data -Dcom.eteks.sweethome3d.applicationFolders=data -Dcom.eteks.sweethome3d.deploymentInformation=portable -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Portable</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
SWEET HOME 3D VIEWER v 6.1
--------------------------
SWEET HOME 3D VIEWER v 6.1.2
----------------------------
This archive contains files required to install Sweet Home 3D Viewer, an
applet able to display the 3D view of a Sweet Home 3D file from its URL.
......
......@@ -2,7 +2,7 @@
;
; Sweet Home 3D, Copyright (c) 2007-2019 Emmanuel PUYBARET / eTeks <info@eteks.com>
;
; SweetHome3D-6.1-windows.exe setup program creator
; SweetHome3D-6.1.2-windows.exe setup program creator
; This UTF-8 BOM encoded script requires Inno Setup Unicode available at http://www.jrsoftware.org/isinfo.php
; and a build directory stored in current directory containing :
; a SweetHome3D.exe file built with launch4j
......@@ -14,9 +14,9 @@
[Setup]
DisableWelcomePage=no
AppName=Sweet Home 3D
AppVersion=6.1
AppVersion=6.1.2
AppCopyright=Copyright (c) 2007-2019 eTeks
AppVerName=Sweet Home 3D version 6.1
AppVerName=Sweet Home 3D version 6.1.2
AppPublisher=eTeks
AppPublisherURL=http://www.eteks.com
AppSupportURL=http://sweethome3d.sourceforge.net
......@@ -26,13 +26,13 @@ DefaultDirName={pf}\Sweet Home 3D
DefaultGroupName=eTeks Sweet Home 3D
LicenseFile=..\..\COPYING.TXT
OutputDir=.
OutputBaseFilename=SweetHome3D-6.1-windows
OutputBaseFilename=SweetHome3D-6.1.2-windows
Compression=lzma2/ultra64
SolidCompression=yes
ChangesAssociations=yes
ExtraDiskSpaceRequired=107000000
VersionInfoVersion=6.1.0.0
VersionInfoTextVersion=6.1
VersionInfoVersion=6.1.2.0
VersionInfoTextVersion=6.1.2
VersionInfoDescription=Sweet Home 3D Setup
VersionInfoCopyright=Copyright (c) 2007-2019 eTeks
VersionInfoCompany=eTeks
......
......@@ -53,12 +53,12 @@
<opt>-Djava.library.path=lib -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Installer</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -51,12 +51,12 @@
<opt>-Djava.library.path=lib -Dj3d.rend=d3d -Dsun.java2d.d3d=true -Dsun.java2d.noddraw=false -Dsun.java2d.ddoffscreen=true -Dsun.java2d.ddscale=true -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Installer</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -51,12 +51,12 @@
<opt>-Djava.library.path=lib -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Installer</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -55,12 +55,12 @@
<opt>-Djava.library.path=lib/java3d-1.6 -Djogamp.gluegen.UseTempJarCache=false -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Installer</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -53,12 +53,12 @@
<opt>-Djava.library.path=lib/java3d-1.6 -Djogamp.gluegen.UseTempJarCache=false -Dcom.eteks.sweethome3d.applicationId=SweetHome3D#Installer</opt>
</jre>
<versionInfo>
<fileVersion>6.1.0.0</fileVersion>
<txtFileVersion>6.1</txtFileVersion>
<fileVersion>6.1.2.0</fileVersion>
<txtFileVersion>6.1.2</txtFileVersion>
<fileDescription>Sweet Home 3D</fileDescription>
<copyright>Copyright (c) 2007-2019 eTeks</copyright>
<productVersion>6.1.0.0</productVersion>
<txtProductVersion>6.1</txtProductVersion>
<productVersion>6.1.2.0</productVersion>
<txtProductVersion>6.1.2</txtProductVersion>
<productName>Sweet Home 3D</productName>
<companyName>eTeks</companyName>
<internalName>SweetHome3D</internalName>
......
......@@ -2,7 +2,7 @@
;
; Sweet Home 3D, Copyright (c) 2007-2019 Emmanuel PUYBARET / eTeks <info@eteks.com>
;
; SweetHome3D-6.1-windows.exe setup program creator
; SweetHome3D-6.1.2-windows.exe setup program creator
; This UTF-8 BOM encoded script requires Inno Setup Unicode available at http://www.jrsoftware.org/isinfo.php
; and a build directory stored in current directory containing :
; a SweetHome3D.exe file built with launch4j
......@@ -14,9 +14,9 @@
[Setup]
DisableWelcomePage=no
AppName=Sweet Home 3D
AppVersion=6.1
AppVersion=6.1.2
AppCopyright=Copyright (c) 2007-2019 eTeks
AppVerName=Sweet Home 3D version 6.1
AppVerName=Sweet Home 3D version 6.1.2
AppPublisher=eTeks
AppPublisherURL=http://www.eteks.com
AppSupportURL=http://sweethome3d.sourceforge.net
......@@ -26,13 +26,13 @@ DefaultDirName={pf}\Sweet Home 3D
DefaultGroupName=eTeks Sweet Home 3D
LicenseFile=..\..\COPYING.TXT
OutputDir=.
OutputBaseFilename=SweetHome3D-6.1-windows
OutputBaseFilename=SweetHome3D-6.1.2-windows
Compression=lzma2/ultra64
SolidCompression=yes
ChangesAssociations=yes
ExtraDiskSpaceRequired=107000000
VersionInfoVersion=6.1.0.0
VersionInfoTextVersion=6.1
VersionInfoVersion=6.1.2.0
VersionInfoTextVersion=6.1.2
VersionInfoDescription=Sweet Home 3D Setup
VersionInfoCopyright=Copyright (c) 2007-2019 eTeks
VersionInfoCompany=eTeks
......
/* * @(#)JeksDisplay.java 01/04/98 * * Copyright (c) 2000 Emmanuel PUYBARET / eTeks <info@eteks.com>. All Rights Reserved. * * This program 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; either version 2 of the License, or * (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Visit eTeks web site for up-to-date versions of this file and other * Java tools and tutorials : http://www.eteks.com/ */import java.applet.Applet;import java.awt.Component;import java.awt.TextField;import java.awt.TextComponent;import java.awt.CheckboxGroup;import java.awt.Checkbox;import java.awt.Button;import java.awt.Panel;import java.awt.Label;import java.awt.GridLayout;import java.awt.GridBagLayout;import java.awt.GridBagConstraints;import java.awt.BorderLayout;import java.awt.Event;import java.awt.Insets;import java.util.StringTokenizer;import java.util.NoSuchElementException; import com.eteks.parser.FunctionParser;import com.eteks.parser.CompiledFunction;import com.eteks.parser.CompilationException; import com.eteks.tools.awt.Curve2DDisplay;import com.eteks.tools.awt.Curve3DDisplay; /** * An applet able to display 2D or 3D curves defined by their function <i>f(x)=...</i> * or <i>f(x,y)=...</i>. * * @version 1.0 * @author Emmanuel Puybaret * @since Jeks 1.0 */public class JeksDisplay extends Applet{ private TextField functionField; private TextField parameterField; private Label resultLabel; private TextField minimumX; private TextField maximumX; private CheckboxGroup displayModeGroup; private Checkbox ligthingCheckbox; private Checkbox meshCheckbox; private Checkbox allMeshCheckbox; private Button defaultButton; private Panel containerDisplayParam; private Panel containerParam3D; private Component curveDisplay; private Curve2DDisplay displayCanvas2D = new Curve2DDisplay (); private Curve3DDisplay displayCanvas3D = new Curve3DDisplay (); private FunctionParser parser = new FunctionParser (); private CompiledFunction lastFunction; private int meshSize = 20; public void init () { // Build GUI setLayout (new BorderLayout (4, 4)); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); Panel containerInput = new Panel (); containerInput.setLayout (gridbag); Label label = new Label ("Function :"); c.fill = GridBagConstraints.BOTH; c.insets = new Insets (2, 1, 2, 1); gridbag.setConstraints (label, c); containerInput.add (label); functionField = new TextField (); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.; gridbag.setConstraints (functionField, c); containerInput.add (functionField); label = new Label ("Compute :"); c.gridwidth = 1; c.weightx = 0.; gridbag.setConstraints (label, c); containerInput.add (label); parameterField = new TextField (); c.gridwidth = 1; c.weightx = 0.2; gridbag.setConstraints (parameterField, c); containerInput.add (parameterField); resultLabel = new Label (); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.8; gridbag.setConstraints(resultLabel, c); containerInput.add (resultLabel); add ("North", containerInput); // Minimum / Maximum Panel containerMinMax = new Panel (); containerMinMax.setLayout (new GridLayout (4, 1, 1, 1)); containerMinMax.add (new Label ("Minimum :")); minimumX = new TextField ("-2"); containerMinMax.add (minimumX); containerMinMax.add (new Label ("Maximum :")); maximumX = new TextField ("2"); containerMinMax.add (maximumX); // 3D parameters containerParam3D = new Panel (); containerParam3D.setLayout (new GridLayout (5, 1, 1, 1)); containerParam3D.add (new Label ("Mesh mode :")); displayModeGroup = new CheckboxGroup (); allMeshCheckbox = new Checkbox ("Complete mesh", displayModeGroup, true); containerParam3D.add (allMeshCheckbox); meshCheckbox = new Checkbox ("White mesh", displayModeGroup, false); containerParam3D.add (meshCheckbox); ligthingCheckbox = new Checkbox ("Lighted mesh", displayModeGroup, false); containerParam3D.add (ligthingCheckbox); defaultButton = new Button ("Default position"); containerParam3D.add (defaultButton); // Display parameters gridbag = new GridBagLayout(); c = new GridBagConstraints(); containerDisplayParam = new Panel (); containerDisplayParam.setLayout (gridbag); c.insets = new Insets (2, 1, 2, 1); c.gridwidth = GridBagConstraints.REMAINDER; c.anchor = GridBagConstraints.NORTHWEST; gridbag.setConstraints (containerMinMax, c); gridbag.setConstraints (containerParam3D, c); containerDisplayParam.add (containerMinMax); // containerParam3D added when needed add ("East", containerDisplayParam); // Retrieve parameters String param = getParameter ("meshSize"); if (param != null) meshSize = Integer.parseInt (param); param = getParameter ("defaultFunction"); if (param != null) { ((TextComponent)functionField).setText (param); postEvent (new Event (functionField, Event.ACTION_EVENT, param)); } } public boolean action (Event event, Object eventArg) { if (event.target == functionField) try { // Compile the user function CompiledFunction function = parser.compileFunction (functionField.getText ()); if ( function.getParameterCount () == 1 || function.getParameterCount () == 2) { resultLabel.setText ("Compilation of " + function.getName () + " OK."); displayFunction (function); } else resultLabel.setText ("Error : Can display only functions with 1 or 2 parameters."); } catch (CompilationException e) { StringBuffer pointer = new StringBuffer ("^"); for (int i = 0; i < e.getCharacterIndex (); i++) pointer.insert (0, ' '); resultLabel.setText ("Error : " + e.getMessage () + "."); } else if (lastFunction != null) if ( event.target == minimumX || event.target == maximumX) displayFunction (lastFunction); else if (event.target == parameterField) try { StringTokenizer rechStr = new StringTokenizer (parameterField.getText (), " (,)"); if (!lastFunction.getName ().equals (rechStr.nextToken ())) throw new IllegalArgumentException ("Unkonwn function"); double [] parameters = new double [lastFunction.getParameterCount ()]; for (int i = 0; i < lastFunction.getParameterCount (); i++) parameters [i] = Double.valueOf (rechStr.nextToken ()).doubleValue (); resultLabel.setText ( "Result of " + parameterField.getText () + " = " + lastFunction.computeFunction (parameters)); } catch (NumberFormatException e) { resultLabel.setText ("Error : " + e + "."); } catch (IllegalArgumentException e) { resultLabel.setText ("Error : " + e + "."); } catch (NoSuchElementException e) { resultLabel.setText ("Error : Missing function or parameters"); } else if (lastFunction.getParameterCount () == 2) if (event.target == defaultButton) displayCanvas3D.setDefaultPosition (); else if (event.target == ligthingCheckbox) displayCanvas3D.setDisplayMode (Curve3DDisplay.DISPLAY_WITH_LIGHTING); else if (event.target == meshCheckbox) displayCanvas3D.setDisplayMode (Curve3DDisplay.DISPLAY_MESH); else if (event.target == allMeshCheckbox) displayCanvas3D.setDisplayMode (Curve3DDisplay.DISPLAY_ALL_MESH); return true; } private void displayFunction (CompiledFunction function) { lastFunction = function; if (curveDisplay != null) remove (curveDisplay); if (lastFunction.getParameterCount () == 1) { curveDisplay = displayCanvas2D; containerDisplayParam.remove (containerParam3D); displayCanvas2D.computeCurve (lastFunction, Double.valueOf (minimumX.getText ()).doubleValue (), Double.valueOf (maximumX.getText ()).doubleValue ()); } else { curveDisplay = displayCanvas3D; containerDisplayParam.add (containerParam3D); displayCanvas3D.computeCurve (lastFunction, Double.valueOf (minimumX.getText ()).doubleValue (), Double.valueOf (maximumX.getText ()).doubleValue (), meshSize); } add ("Center", curveDisplay); validate (); } }
\ No newline at end of file
/*
* @(#)JeksJavaPerformanceTest.java 04/19/2001
*
* Copyright (c) 1998-2001 Emmanuel PUYBARET / eTeks <info@eteks.com>. All Rights Reserved.
*
* This program 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; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Visit eTeks web site for up-to-date versions of this file and other
* Java tools and tutorials : http://www.eteks.com/
*/
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.Image;
import java.awt.Component;
import java.awt.Button;
import java.awt.Label;
import java.awt.Frame;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Panel;
import java.awt.Canvas;
import java.awt.Insets;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Event;
import java.awt.Window;
import com.eteks.tools.awt.GridBagConstraints2;
import com.eteks.parser.FunctionParser;
import com.eteks.parser.JavaSyntax;
import com.eteks.parser.CompiledFunction;
import com.eteks.parser.CompilationException;
/**
* Jeks demo. This demo allows to compare the computing average speed
* of different functions parsed with Jeks and Java function with a speed meter dialog box.
* This is Java 1.0 compatible code.
*
* @version 1.0.2
* @author Emmanuel Puybaret
* @since Jeks 1.0
*/
public class JeksJavaPerformanceTest
{
/**
* An example of use for Pure Java AWT Toolkit.
*/
public static void main (String args [])
{
// First display an information dialog box
showFirstDialog ();
// Create an array of the functions to be tested
FunctionTest tests [] = {new OperatorsTest (),
new CommonFunctionsTest (),
new MultipleFunctionsTest ()};
// Show a dialog that compares drawing speed
showSpeedMeterDialog (tests);
}
private static void showFirstDialog ()
{
// Dialog box for copyrights
final Dialog firstDialog = new Dialog (new Frame (), "Jeks parser", true)
{
// This demo uses old Event model to be able to run with JDK 1.0
public boolean action (Event evt, Object arg)
{
// This is a trick to be sure Window.dispose () is called in JDK 1.0
((Window)this).dispose ();
return true;
}
};
Component object;
GridBagLayout layout = new GridBagLayout ();
firstDialog.setLayout (layout);
firstDialog.add (object = new Label ("Jeks parser / Java performance test."));
layout.setConstraints (object, new GridBagConstraints2 (GridBagConstraints.REMAINDER, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (5, 5, 0, 5), 0, 0));
firstDialog.add (object = new Label ("\u00a9 Copyright 1998-2001 eTeks <info@eteks.com>."));
layout.setConstraints (object, new GridBagConstraints2 (GridBagConstraints.REMAINDER, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (0, 5, 20, 5), 0, 0));
firstDialog.add (object = new Button (" Ok "));
layout.setConstraints (object, new GridBagConstraints2 (GridBagConstraints.REMAINDER, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (20, 0, 10, 0), 0, 0));
firstDialog.setResizable (false);
firstDialog.pack ();
// This is a trick to be sure Window.show () is called in JDK 1.0
((Window)firstDialog).show ();
}
static interface FunctionTest
{
FunctionParser PARSER = new FunctionParser (new JavaSyntax ());
double computeJeksFunction ();
double computeJavaFunction ();
int getLoopCount ();
}
// Simple calculation test using constant PI, unary and binary operators
static class OperatorsTest implements FunctionTest
{
CompiledFunction function;
public OperatorsTest ()
{
try
{
function = PARSER.compileFunction ("func (x) = Math.PI * +x * (x + -x / 3.) - 5E-2");
if (computeJeksFunction () != computeJavaFunction ())
throw new RuntimeException ("Jeks and Java give different results !");
}
catch (CompilationException ex)
{
ex.printStackTrace ();
System.exit (0);
}
}
public double computeJeksFunction ()
{
return function.computeFunction (new double [] {10});
}
public double computeJavaFunction ()
{
return func (10);
}
public double func (double x)
{
return Math.PI * +x * (x + -x / 3.) - 5E-2;
}
public int getLoopCount ()
{
return 50000;
}
public String toString ()
{
return "Operators : Math.PI * +x * (x + -x / 3) - 5E-2";
}
}
// Common functions test using sin, cos, pow
static class CommonFunctionsTest implements FunctionTest
{
CompiledFunction function;
public CommonFunctionsTest ()
{
try
{
function = PARSER.compileFunction ("func (x, y) = Math.cos (x) * Math.sin (y) + Math.pow (x / y, 1.2)");
if (computeJeksFunction () != computeJavaFunction ())
throw new RuntimeException ("Jeks and Java give different results !");
}
catch (CompilationException ex)
{
ex.printStackTrace ();
System.exit (0);
}
}
public double computeJeksFunction ()
{
return function.computeFunction (new double [] {5.33, 4.5});
}
public double computeJavaFunction ()
{
return func (5.33, 4.5);
}
public double func (double x, double y)
{
return Math.cos (x) * Math.sin (y) + Math.pow (x / y, 1.2);
}
public int getLoopCount ()
{
return 10000;
}
public String toString ()
{
return "CommonFunctions : Math.cos (x) * Math.sin (y) + Math.pow (x / y, 1.2)";
}
}
// Multiple functions test using multiple functions calls
static class MultipleFunctionsTest implements FunctionTest
{
CompiledFunction function;
public MultipleFunctionsTest ()
{
try
{
// v1.0.2 changed the order of parameters to be the same as Excel's PMT
function = PARSER.compileFunction ("capitalPaid (rate, count, capital, testedPMT)= count <= 0 ? 0 : testedPMT - capital * rate + capitalPaid (rate, count - 1, capital - (testedPMT - capital * rate), testedPMT)");
((JavaSyntax)PARSER.getSyntax ()).addFunction (function);
function = PARSER.compileFunction ("computePMT (rate, count, capital, capitalPaid1, capitalPaid2, testedPMT1, testedPMT2)=Math.abs (capitalPaid1 - capital) < 0.01 ? testedPMT1 : Math.abs (capitalPaid1 - capital) < Math.abs (capitalPaid2 - capital) ? computePMT (rate, count, capital, capitalPaid1, capitalPaid (rate, count, capital, testedPMT2 - (testedPMT2 - testedPMT1) / 2), testedPMT1, testedPMT2 - (testedPMT2 - testedPMT1) / 2) : computePMT (rate, count, capital, capitalPaid (rate, count, capital, testedPMT1 + (testedPMT2 - testedPMT1) / 2), capitalPaid2, testedPMT1 + (testedPMT2 - testedPMT1) / 2, testedPMT2)");
((JavaSyntax)PARSER.getSyntax ()).addFunction (function);
function = PARSER.compileFunction ("PMT (rate, count, capital)=computePMT (rate, count, capital, capitalPaid (rate, count, capital, capital / count), capitalPaid (rate, count, capital, capital * Math.pow ((1 + rate), count)) / count, capital / count, capital * Math.pow ((1 + rate), count) / count)");
if (computeJeksFunction () != computeJavaFunction ())
throw new RuntimeException ("Jeks and Java give different results !");
}
catch (CompilationException ex)
{
ex.printStackTrace ();
System.exit (0);
}
}
public double computeJeksFunction ()
{
return function.computeFunction (new double [] {.065, 60, 10000});
}
public double computeJavaFunction ()
{
return PMT (.065, 60, 10000);
}
public double capitalPaid (double rate, double count, double capital, double testedPMT)
{
// This could be done faster in Java with a loop
return count <= 0
? 0
: testedPMT - capital * rate + capitalPaid (rate, count - 1, capital - (testedPMT - capital * rate), testedPMT);
}
public double computePMT (double rate, double count, double capital, double capitalPaid1, double capitalPaid2, double testedPMT1, double testedPMT2)
{
return Math.abs (capitalPaid1 - capital) < 0.01
? testedPMT1
: Math.abs (capitalPaid1 - capital) < Math.abs (capitalPaid2 - capital)
? computePMT (rate, count, capital, capitalPaid1, capitalPaid (rate, count, capital, testedPMT2 - (testedPMT2 - testedPMT1) / 2), testedPMT1, testedPMT2 - (testedPMT2 - testedPMT1) / 2)
: computePMT (rate, count, capital, capitalPaid (rate, count, capital, testedPMT1 + (testedPMT2 - testedPMT1) / 2), capitalPaid2, testedPMT1 + (testedPMT2 - testedPMT1) / 2, testedPMT2);
}
public double PMT (double rate, double count, double capital)
{
return computePMT (rate, count, capital, capitalPaid (rate, count, capital, capital / count), capitalPaid (rate, count, capital, capital * Math.pow ((1 + rate), count)) / count, capital / count, capital * Math.pow ((1 + rate), count) / count);
}
public int getLoopCount ()
{
return 100;
}
public String toString ()
{
return "MultipleFunctions : PMT (rate, count, capital) = computePMT (...)";
}
}
private static void showSpeedMeterDialog (final FunctionTest tests [])
{
final Dialog speedMeterDialog = new Dialog (new Frame (), "Average computation duration", false)
{
// This demo uses old Event model to be able to run with JDK 1.0
public boolean action (Event evt, Object arg)
{
System.exit (0);
return true;
}
};
// Build the speed meter dialog with all its labels
GridBagLayout layout = new GridBagLayout ();
speedMeterDialog.setLayout (layout);
// Left column titles panel
Panel titlePanel = new Panel ();
titlePanel.setLayout (new GridLayout (tests.length + 1, 1, 0, 10));
// Speed values table panel
Panel speedPanel = new Panel ();
speedPanel.setLayout (new GridLayout (tests.length + 1, 3, 10, 10));
titlePanel.add (new Label (""));
speedPanel.add (new Label ("Jeks (\u00b5s)", Label.CENTER));
speedPanel.add (new Label ("Java (\u00b5s)", Label.CENTER));
speedPanel.add (new Label ("Ratio (Jeks/Java)", Label.CENTER));
Label jeksAverageDurationLabel [] = new Label [tests.length];
Label javaAverageDurationLabel [] = new Label [tests.length];
Label ratioLabel [] = new Label [tests.length];
for (int i = 0; i < tests.length; i++)
{
titlePanel.add (new Label (tests [i].toString ()));
jeksAverageDurationLabel [i] = new Label ("0000000 ", Label.RIGHT);
jeksAverageDurationLabel [i].setForeground (Color.green);
jeksAverageDurationLabel [i].setBackground (Color.black);
speedPanel.add (jeksAverageDurationLabel [i]);
javaAverageDurationLabel [i] = new Label ("0000000 ", Label.RIGHT);
javaAverageDurationLabel [i].setForeground (Color.red);
javaAverageDurationLabel [i].setBackground (Color.black);
speedPanel.add (javaAverageDurationLabel [i]);
ratioLabel [i] = new Label (" 1 ", Label.RIGHT);
ratioLabel [i].setForeground (Color.lightGray);
ratioLabel [i].setBackground (Color.black);
speedPanel.add (ratioLabel [i]);
}
speedMeterDialog.add (titlePanel);
layout.setConstraints (titlePanel, new GridBagConstraints2 (0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (10, 10, 10, 10), 0, 0));
speedMeterDialog.add (speedPanel);
layout.setConstraints (speedPanel, new GridBagConstraints2 (1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (10, 0, 10, 10), 0, 0));
Button button = new Button (" Quit ");
speedMeterDialog.add (button);
layout.setConstraints (button, new GridBagConstraints2 (0, 1, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (10, 0, 10, 0), 0, 0));
speedMeterDialog.setResizable (false);
speedMeterDialog.pack ();
// This is a trick to be sure Window.show () is called in JDK 1.0
((Window)speedMeterDialog).show ();
final long jeksTotalDuration [] = new long [tests.length];
final long javaTotalDuration [] = new long [tests.length];
for (int testCount = 1; ; testCount++)
{
for (int i = 0; i < tests.length; i++)
{
long currentTime = System.currentTimeMillis ();
jeksTotalDuration [i] += getJeksTestDuration (tests [i]);
jeksAverageDurationLabel [i].setText (String.valueOf ((float)jeksTotalDuration [i] * 1000f / (testCount * tests [i].getLoopCount ())) + " ");
javaTotalDuration [i] += getJavaTestDuration (tests [i]);
javaAverageDurationLabel [i].setText (String.valueOf ((float)javaTotalDuration [i] * 1000f / (testCount * tests [i].getLoopCount ())) + " ");
// Update ratio label
ratioLabel [i].setText (javaTotalDuration [i] != 0
? String.valueOf ((int)Math.round ((double)jeksTotalDuration [i] / javaTotalDuration [i])) + " "
: "");
try
{
long ellapsedTime = System.currentTimeMillis () - currentTime;
// Let a chance to your system to breath a little :
// If ellapsedTime was less than 0.05 s then wait next .1 second
// otherwise wait .1 s
Thread.sleep (ellapsedTime < 50
? (100 - ellapsedTime)
: 100);
}
catch (InterruptedException e)
{ }
}
}
}
private static long getJeksTestDuration (FunctionTest test)
{
System.gc ();
// Get current time, compute many times and return duration
long currentTime = System.currentTimeMillis ();
for (int i = test.getLoopCount (); i-- > 0; )
test.computeJeksFunction ();
return System.currentTimeMillis () - currentTime;
}
private static long getJavaTestDuration (FunctionTest test)
{
System.gc ();
// Get current time, compute many times and return duration
long currentTime = System.currentTimeMillis ();
for (int i = test.getLoopCount () * 100; i-- > 0; )
test.computeJavaFunction ();
return (System.currentTimeMillis () - currentTime) / 100;
}
}
Manifest-Version: 1.0
Main-Class: com.eteks.jeks.JeksFrame
......@@ -23,7 +23,7 @@ AppletApplication.3DError.message=<html>Sweet Home 3D can't work correctly becau
AppletApplication.3DError.title=3D Error
# Note to translators: do not copy the following key in localized file
AppletApplication.applicationVersion=6.1
AppletApplication.applicationVersion=6.1.2
AppletApplication.memoryStatus=Memory used by applet: %d%% out of %d MB
......