Make first real commit: copy of CaRMetal 4.2.8
158
Main.java
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
|
||||||
|
|
||||||
|
import eric.FileTools;
|
||||||
|
import eric.GUI.palette.PaletteManager;
|
||||||
|
import eric.GUI.window.MainApplet;
|
||||||
|
import eric.JLogoWindow;
|
||||||
|
import eric.JSprogram.ScriptThread;
|
||||||
|
import eric.OS;
|
||||||
|
import eric.macros.MacroTools;
|
||||||
|
import eric.bar.JPropertiesBar;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Properties;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import rene.gui.Global;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class Main extends MainApplet {
|
||||||
|
|
||||||
|
public Main() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
rene.gui.Global.DetectDesktopSize();
|
||||||
|
Global.initBundles();
|
||||||
|
|
||||||
|
Global.initProperties();
|
||||||
|
eric.JGlobalPreferences.initPreferences();
|
||||||
|
ScriptThread.InitContextFactory();
|
||||||
|
// Global.FirstRun();
|
||||||
|
JPropertiesBar.CreatePropertiesBar();
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
PaletteManager.init();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
static public void main(final String[] args) {
|
||||||
|
final int PORT=32145;
|
||||||
|
int i=0;
|
||||||
|
String filename="";
|
||||||
|
|
||||||
|
|
||||||
|
while (i<args.length) {
|
||||||
|
if (args[i].startsWith("-l")&&i<args.length-1) {
|
||||||
|
i+=2;
|
||||||
|
} else if (args[i].startsWith("-h")&&i<args.length-1) {
|
||||||
|
i+=2;
|
||||||
|
} else if (args[i].startsWith("-s")) {
|
||||||
|
i++;
|
||||||
|
} else if (args[i].startsWith("-r")) {
|
||||||
|
i++;
|
||||||
|
} else if (args[i].startsWith("-d")) {
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
filename+=args[i]+System.getProperty("path.separator");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final String FILES=filename;
|
||||||
|
// final eric.JUniqueInstance uniqueInstance=new eric.JUniqueInstance(
|
||||||
|
// PORT, FILES);
|
||||||
|
// if (uniqueInstance.launch()) {
|
||||||
|
// if (OS.isMac()) {
|
||||||
|
// new eric.JMacOShandler();
|
||||||
|
// }
|
||||||
|
// mainApplication(args);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (OS.isMac()) {
|
||||||
|
// on mac, things are easy :
|
||||||
|
new eric.JMacOShandler();
|
||||||
|
mainApplication(args);
|
||||||
|
}else if (OS.isWindows()) {
|
||||||
|
// // on windows, use a socket in order to launch unique instance of app :
|
||||||
|
// final eric.JUniqueInstance uniqueInstance=new eric.JUniqueInstance(
|
||||||
|
// PORT, FILES);
|
||||||
|
// if (uniqueInstance.launch()) {
|
||||||
|
// mainApplication(args);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// make things simple without socket, just to see if it's better :
|
||||||
|
mainApplication(args);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
// on linux, make it simple (so, without hability to launch files with double
|
||||||
|
// click when app is already open). Linux doesn't like socket things...
|
||||||
|
mainApplication(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// zirkel is called as application :
|
||||||
|
public static void mainApplication(final String args[]) {
|
||||||
|
|
||||||
|
rene.gui.Global.DetectDesktopSize();
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
String filename="";
|
||||||
|
while (i<args.length) {
|
||||||
|
if (args[i].startsWith("-l")&&i<args.length-1) {
|
||||||
|
Locale.setDefault(new Locale(args[i+1], ""));
|
||||||
|
i+=2;
|
||||||
|
} else if (args[i].startsWith("-h")&&i<args.length-1) {
|
||||||
|
i+=2;
|
||||||
|
} else if (args[i].startsWith("-s")) {
|
||||||
|
i++;
|
||||||
|
} else if (args[i].startsWith("-r")) {
|
||||||
|
i++;
|
||||||
|
} else if (args[i].startsWith("-d")) {
|
||||||
|
final Properties p=System.getProperties();
|
||||||
|
try {
|
||||||
|
final PrintStream out=new PrintStream(
|
||||||
|
new FileOutputStream(p.getProperty("user.home")+p.getProperty("file.separator")+"zirkel.log"));
|
||||||
|
System.setErr(out);
|
||||||
|
System.setOut(out);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
System.out.println("Could not open log file!");
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
filename=args[i];
|
||||||
|
FileTools.addStartupFile(filename);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Global.renameOldHomeDirectory();
|
||||||
|
Global.loadProperties(Global.getHomeDirectory()+"carmetal_config.txt");
|
||||||
|
Global.initBundles();
|
||||||
|
JLogoWindow.ShowLogoWindow(false);
|
||||||
|
Global.setParameter("jsdumb", Global.getParameter("jsdumb", true));
|
||||||
|
// JLogoWindow.ShowLogoWindow();
|
||||||
|
Global.initProperties();
|
||||||
|
MacroTools.createLocalDirectory();
|
||||||
|
eric.JGlobalPreferences.initPreferences();
|
||||||
|
ScriptThread.InitContextFactory();
|
||||||
|
FileTools.FirstRun();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
16
README.md
@ -1,3 +1,17 @@
|
|||||||
# CaRMtl
|
# CaRMtl
|
||||||
|
|
||||||
This is a copy of CaRMetal 4.2.8 (see http://carmetal.org) for tweaking and hacking on it, not a fork or attempt to take it over! See README.
|
This repository is a copy of CaRMetal 4.2.8 (see http://carmetal.org) for
|
||||||
|
tweaking and hacking on it. I created it because there did not seem to be a
|
||||||
|
public code repository for CaRMetal, but there were a number of small projects
|
||||||
|
I wanted to try on its codebase. My intention is to offer all of the changes
|
||||||
|
pursued here back to the maintainers of CaRMetal, if they are receptive. Thus,
|
||||||
|
this repository is not a fork or attempt to take over CaRMetal.
|
||||||
|
|
||||||
|
As such, I wasn't sure what name to give the repository; using exactly
|
||||||
|
CaRMetal seemed presumptuous, but making it too different seemed too much like
|
||||||
|
this was intended as an independent project. Hence, CaRMtl. (Also, it's an
|
||||||
|
awful enough name to be clear that this couldn't be an independent project
|
||||||
|
because if it were, I would surely pick a better name, like CaRWaX or
|
||||||
|
something ;-)
|
||||||
|
|
||||||
|
Happy geometring, Glen.
|
||||||
|
BIN
atp/Des10.gif
Normal file
BIN
atp/Des12.gif
Normal file
BIN
atp/Des14.gif
Normal file
BIN
atp/Des18.gif
Normal file
BIN
atp/Des8.gif
Normal file
BIN
atp/Fonts10.gif
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
atp/Fonts12.gif
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
atp/Fonts14.gif
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
atp/Fonts18.gif
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
atp/Fonts8.gif
Normal file
After Width: | Height: | Size: 3.7 KiB |
60
atp/a.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* HotEqn Equation Viewer Basic Applet *
|
||||||
|
* *
|
||||||
|
******************************************************************************
|
||||||
|
* Java Applet to view mathematical Equations provided in the LaTeX language *
|
||||||
|
******************************************************************************
|
||||||
|
|
||||||
|
Copyright 2006 Stefan Müller and Christian Schmid, modified by Rene Grothmann
|
||||||
|
|
||||||
|
This file is part of the HotEqn package.
|
||||||
|
|
||||||
|
HotEqn 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;
|
||||||
|
HotEqn 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package atp;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.image.RGBImageFilter;
|
||||||
|
|
||||||
|
class a extends RGBImageFilter {
|
||||||
|
|
||||||
|
Color a;
|
||||||
|
boolean _fldif;
|
||||||
|
|
||||||
|
a(final Color color) {
|
||||||
|
_fldif = false;
|
||||||
|
a = color;
|
||||||
|
_fldif = false;
|
||||||
|
super.canFilterIndexColorModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
a(final Color color, final boolean flag) {
|
||||||
|
_fldif = false;
|
||||||
|
a = color;
|
||||||
|
_fldif = flag;
|
||||||
|
super.canFilterIndexColorModel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int filterRGB(final int i, final int j, final int k) {
|
||||||
|
if (_fldif) {
|
||||||
|
return 0x1fff0000;
|
||||||
|
}
|
||||||
|
final int l = k & 0xffffff;
|
||||||
|
if (l == 0xffffff) {
|
||||||
|
return l;
|
||||||
|
} else {
|
||||||
|
return 0xff000000 | a.getRGB();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1129
atp/b.java
Normal file
43
atp/c.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* HotEqn Equation Viewer Basic Applet *
|
||||||
|
* *
|
||||||
|
******************************************************************************
|
||||||
|
* Java Applet to view mathematical Equations provided in the LaTeX language *
|
||||||
|
******************************************************************************
|
||||||
|
|
||||||
|
Copyright 2006 Stefan Müller and Christian Schmid, modified by Rene Grothmann
|
||||||
|
|
||||||
|
This file is part of the HotEqn package.
|
||||||
|
|
||||||
|
HotEqn 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;
|
||||||
|
HotEqn 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package atp;
|
||||||
|
|
||||||
|
class c {
|
||||||
|
|
||||||
|
public int _flddo;
|
||||||
|
public int _fldif;
|
||||||
|
public int a;
|
||||||
|
|
||||||
|
public c(final int i, final int j, final int k) {
|
||||||
|
_flddo = i;
|
||||||
|
_fldif = j;
|
||||||
|
a = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
public c() {
|
||||||
|
_flddo = 0;
|
||||||
|
_fldif = 0;
|
||||||
|
a = 0;
|
||||||
|
}
|
||||||
|
}
|
176
atp/d.java
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* HotEqn Equation Viewer Basic Applet *
|
||||||
|
* *
|
||||||
|
******************************************************************************
|
||||||
|
* Java Applet to view mathematical Equations provided in the LaTeX language *
|
||||||
|
******************************************************************************
|
||||||
|
|
||||||
|
Copyright 2006 Stefan Müller and Christian Schmid, modified by Rene Grothmann
|
||||||
|
|
||||||
|
This file is part of the HotEqn package.
|
||||||
|
|
||||||
|
HotEqn 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;
|
||||||
|
HotEqn 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package atp;
|
||||||
|
|
||||||
|
import java.applet.Applet;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.image.CropImageFilter;
|
||||||
|
import java.awt.image.FilteredImageSource;
|
||||||
|
import java.awt.image.ImageProducer;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
// Referenced classes of package atp:
|
||||||
|
// a
|
||||||
|
|
||||||
|
class d {
|
||||||
|
|
||||||
|
private final ImageProducer _flddo[] = { null, null, null, null, null };
|
||||||
|
private final String _fldif[] = { "8", "10", "12", "14", "18" };
|
||||||
|
private final Hashtable _fldfor;
|
||||||
|
private static boolean a = true;
|
||||||
|
|
||||||
|
public d() {
|
||||||
|
_fldfor = new Hashtable(189);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image a(final boolean flag, final boolean flag1, final String s,
|
||||||
|
final Graphics2D g, final Applet applet) {
|
||||||
|
final StringTokenizer stringtokenizer = new StringTokenizer(s, "/");
|
||||||
|
String s1 = stringtokenizer.nextToken();
|
||||||
|
s1 = stringtokenizer.nextToken().substring(5);
|
||||||
|
final String s2 = stringtokenizer.nextToken();
|
||||||
|
int i = -1;
|
||||||
|
boolean flag2 = true;
|
||||||
|
while (flag2) {
|
||||||
|
if (_fldif[++i].equals(s1)) {
|
||||||
|
flag2 = false;
|
||||||
|
}
|
||||||
|
if (i == 4) {
|
||||||
|
flag2 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_flddo[i] == null) {
|
||||||
|
_flddo[i] = a(flag, flag1, "Fonts" + s1 + ".gif", applet);
|
||||||
|
final String s3 = "Des" + s1 + ".gif";
|
||||||
|
BufferedInputStream bufferedinputstream = null;
|
||||||
|
try {
|
||||||
|
if (a) {
|
||||||
|
getClass().getResourceAsStream(s3);
|
||||||
|
bufferedinputstream = new BufferedInputStream(getClass()
|
||||||
|
.getResourceAsStream(s3));
|
||||||
|
} else if ((!flag) & (!flag1)) {
|
||||||
|
bufferedinputstream = new BufferedInputStream((new URL(s3))
|
||||||
|
.openStream());
|
||||||
|
} else if (flag) {
|
||||||
|
bufferedinputstream = new BufferedInputStream((new URL(
|
||||||
|
applet.getCodeBase(), s3)).openStream());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
bufferedinputstream = new BufferedInputStream(
|
||||||
|
getClass().getResource(s3).openStream());
|
||||||
|
} catch (final Exception exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final ObjectInputStream objectinputstream = new ObjectInputStream(
|
||||||
|
bufferedinputstream);
|
||||||
|
final int j = objectinputstream.readInt();
|
||||||
|
for (int k = 0; k < j; k++) {
|
||||||
|
final String s4 = (String) objectinputstream.readObject();
|
||||||
|
_fldfor.put(s1 + s4, new Rectangle(
|
||||||
|
(Rectangle) objectinputstream.readObject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferedinputstream.close();
|
||||||
|
} catch (final Exception exception1) {
|
||||||
|
// System.out.println(exception1.toString());
|
||||||
|
_flddo[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Image image = null;
|
||||||
|
if (_flddo[i] != null) {
|
||||||
|
final Rectangle rectangle = (Rectangle) _fldfor.get(s1 + s2);
|
||||||
|
image = Toolkit.getDefaultToolkit().createImage(
|
||||||
|
new FilteredImageSource(new FilteredImageSource(_flddo[i],
|
||||||
|
new CropImageFilter(rectangle.x, rectangle.y,
|
||||||
|
rectangle.width, rectangle.height)), new a(
|
||||||
|
g.getColor())));
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageProducer a(final boolean flag, final boolean flag1,
|
||||||
|
final String s, final Applet applet) {
|
||||||
|
ImageProducer imageproducer = null;
|
||||||
|
if (a) {
|
||||||
|
imageproducer = a(s);
|
||||||
|
}
|
||||||
|
if (imageproducer == null) {
|
||||||
|
a = false;
|
||||||
|
if ((!flag) & (!flag1)) {
|
||||||
|
imageproducer = Toolkit.getDefaultToolkit().getImage(s)
|
||||||
|
.getSource();
|
||||||
|
} else if (flag) {
|
||||||
|
imageproducer = applet.getImage(applet.getCodeBase(), s)
|
||||||
|
.getSource();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
final URL url = getClass().getResource(s);
|
||||||
|
imageproducer = (ImageProducer) url.getContent();
|
||||||
|
} catch (final Exception exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return imageproducer;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageProducer a(final String s) {
|
||||||
|
ImageProducer imageproducer = null;
|
||||||
|
try {
|
||||||
|
final InputStream inputstream = getClass().getResourceAsStream(s);
|
||||||
|
int i = inputstream.available();
|
||||||
|
byte abyte0[] = new byte[i];
|
||||||
|
int j = 0;
|
||||||
|
for (int k = 0; k != -1;) {
|
||||||
|
k = inputstream.read(abyte0, j, i);
|
||||||
|
if (k != -1) {
|
||||||
|
j += k;
|
||||||
|
i = inputstream.available();
|
||||||
|
final int l = j + i;
|
||||||
|
if (l > abyte0.length) {
|
||||||
|
final byte abyte1[] = (byte[]) abyte0.clone();
|
||||||
|
abyte0 = new byte[l];
|
||||||
|
System.arraycopy(abyte1, 0, abyte0, 0, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imageproducer = Toolkit.getDefaultToolkit().createImage(abyte0)
|
||||||
|
.getSource();
|
||||||
|
} catch (final Exception exception) {
|
||||||
|
}
|
||||||
|
return imageproducer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
64
atp/e.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package atp;
|
||||||
|
|
||||||
|
class e {
|
||||||
|
|
||||||
|
public int y;
|
||||||
|
public String w;
|
||||||
|
public static final int k = 0;
|
||||||
|
public static final int _fldbyte = 1;
|
||||||
|
public static final int o = 2;
|
||||||
|
public static final int r = 3;
|
||||||
|
public static final int _fldlong = 4;
|
||||||
|
public static final int j = 5;
|
||||||
|
public static final int _fldelse = 7;
|
||||||
|
public static final int _fldfor = 8;
|
||||||
|
public static final int q = 9;
|
||||||
|
public static final int s = 10;
|
||||||
|
public static final int B = 11;
|
||||||
|
public static final int _fldvoid = 12;
|
||||||
|
public static final int _flddo = 13;
|
||||||
|
public static final int t = 14;
|
||||||
|
public static final int _fldchar = 15;
|
||||||
|
public static final int i = 16;
|
||||||
|
public static final int A = 17;
|
||||||
|
public static final int u = 18;
|
||||||
|
public static final int _fldcase = 19;
|
||||||
|
public static final int C = 20;
|
||||||
|
public static final int d = 22;
|
||||||
|
public static final int m = 24;
|
||||||
|
public static final int g = 25;
|
||||||
|
public static final int f = 50;
|
||||||
|
public static final int v = 51;
|
||||||
|
public static final int _fldint = 99;
|
||||||
|
public static final int p = 100;
|
||||||
|
public static final int _fldif = 108;
|
||||||
|
public static final int n = 109;
|
||||||
|
public static final int _fldnull = 110;
|
||||||
|
public static final int a = 113;
|
||||||
|
public static final int b = 114;
|
||||||
|
public static final int c = 115;
|
||||||
|
public static final int D = 116;
|
||||||
|
public static final int l = 117;
|
||||||
|
public static final int h = 118;
|
||||||
|
public static final int z = 119;
|
||||||
|
public static final int x = 120;
|
||||||
|
public static final int _fldnew = 121;
|
||||||
|
public static final int _fldtry = 122;
|
||||||
|
public static final int e = 123;
|
||||||
|
public static final int _fldgoto = 124;
|
||||||
|
|
||||||
|
public e(final int i1, final String s1) {
|
||||||
|
y = i1;
|
||||||
|
w = s1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public e(final int i1) {
|
||||||
|
y = i1;
|
||||||
|
w = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public e() {
|
||||||
|
y = 0;
|
||||||
|
w = "";
|
||||||
|
}
|
||||||
|
}
|
134
atp/f.java
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* *
|
||||||
|
* HotEqn Equation Viewer Basic Applet *
|
||||||
|
* *
|
||||||
|
******************************************************************************
|
||||||
|
* Java Applet to view mathematical Equations provided in the LaTeX language *
|
||||||
|
******************************************************************************
|
||||||
|
|
||||||
|
Copyright 2006 Stefan Müller and Christian Schmid, modified by Rene Grothmann
|
||||||
|
|
||||||
|
This file is part of the HotEqn package.
|
||||||
|
|
||||||
|
HotEqn 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;
|
||||||
|
HotEqn 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package atp;
|
||||||
|
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.image.CropImageFilter;
|
||||||
|
import java.awt.image.FilteredImageSource;
|
||||||
|
import java.awt.image.ImageProducer;
|
||||||
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.util.Hashtable;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
// Referenced classes of package atp:
|
||||||
|
// a
|
||||||
|
|
||||||
|
class f {
|
||||||
|
|
||||||
|
private final ImageProducer _flddo[] = { null, null, null, null, null };
|
||||||
|
private final String _fldif[] = { "8", "10", "12", "14", "18" };
|
||||||
|
private final Hashtable _fldfor;
|
||||||
|
|
||||||
|
public f() {
|
||||||
|
_fldfor = new Hashtable(189);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Image a(final String s, final Graphics2D g) {
|
||||||
|
final StringTokenizer stringtokenizer = new StringTokenizer(s, "/");
|
||||||
|
String s1 = stringtokenizer.nextToken();
|
||||||
|
s1 = stringtokenizer.nextToken().substring(5);
|
||||||
|
final String s2 = stringtokenizer.nextToken();
|
||||||
|
int i = -1;
|
||||||
|
boolean flag2 = true;
|
||||||
|
while (flag2) {
|
||||||
|
if (_fldif[++i].equals(s1)) {
|
||||||
|
flag2 = false;
|
||||||
|
}
|
||||||
|
if (i == 4) {
|
||||||
|
flag2 = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_flddo[i] == null) {
|
||||||
|
_flddo[i] = a("Fonts" + s1 + ".gif");
|
||||||
|
final String s3 = "Des" + s1 + ".gif";
|
||||||
|
BufferedInputStream bufferedinputstream = null;
|
||||||
|
try {
|
||||||
|
getClass().getResourceAsStream(s3);
|
||||||
|
bufferedinputstream = new BufferedInputStream(getClass()
|
||||||
|
.getResourceAsStream(s3));
|
||||||
|
final ObjectInputStream objectinputstream = new ObjectInputStream(
|
||||||
|
bufferedinputstream);
|
||||||
|
final int j = objectinputstream.readInt();
|
||||||
|
for (int k = 0; k < j; k++) {
|
||||||
|
final String s4 = (String) objectinputstream.readObject();
|
||||||
|
_fldfor.put(s1 + s4, new Rectangle(
|
||||||
|
(Rectangle) objectinputstream.readObject()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferedinputstream.close();
|
||||||
|
} catch (final Exception exception1) {
|
||||||
|
// System.out.println(exception1.toString());
|
||||||
|
_flddo[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Image image = null;
|
||||||
|
if (_flddo[i] != null) {
|
||||||
|
final Rectangle rectangle = (Rectangle) _fldfor.get(s1 + s2);
|
||||||
|
image = Toolkit.getDefaultToolkit().createImage(
|
||||||
|
new FilteredImageSource(new FilteredImageSource(_flddo[i],
|
||||||
|
new CropImageFilter(rectangle.x, rectangle.y,
|
||||||
|
rectangle.width, rectangle.height)), new a(
|
||||||
|
g.getColor())));
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImageProducer a(final String s) {
|
||||||
|
ImageProducer imageproducer = null;
|
||||||
|
try {
|
||||||
|
final InputStream inputstream = getClass().getResourceAsStream(s);
|
||||||
|
int i = inputstream.available();
|
||||||
|
byte abyte0[] = new byte[i];
|
||||||
|
int j = 0;
|
||||||
|
for (int k = 0; k != -1;) {
|
||||||
|
k = inputstream.read(abyte0, j, i);
|
||||||
|
if (k != -1) {
|
||||||
|
j += k;
|
||||||
|
i = inputstream.available();
|
||||||
|
final int l = j + i;
|
||||||
|
if (l > abyte0.length) {
|
||||||
|
final byte abyte1[] = (byte[]) abyte0.clone();
|
||||||
|
abyte0 = new byte[l];
|
||||||
|
System.arraycopy(abyte1, 0, abyte0, 0, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
imageproducer = Toolkit.getDefaultToolkit().createImage(abyte0)
|
||||||
|
.getSource();
|
||||||
|
} catch (final Exception exception) {
|
||||||
|
}
|
||||||
|
return imageproducer;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
2027
atp/sHotEqn.java
Normal file
139
base3D-es.zir
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Script Name="vista de techo" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=(90-teta)/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",90);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vista de frente" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=-phi/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",0);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vista derecha" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(-90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",-90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vista izquierda" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vista estándar" onload="false">
|
||||||
|
SetExpressionValue("E10","-100*windowcx");
|
||||||
|
SetExpressionValue("E11","100*windowcy");
|
||||||
|
</Script>
|
||||||
|
<Construction>
|
||||||
|
<Window x="0.42325882781637736" y="0.2640459857446189" w="4.489848193237493"/>
|
||||||
|
<Windowdim w="1280" h="800"/>
|
||||||
|
<Preferences arrowsize="15" selectionsize="5" monkeyspeed="10" gridopacity="13" colorbackgroundx="139" colorbackgroundy="9" colorbackgroundPal="4" fig3D="true" figDP="false"/>
|
||||||
|
<CTRLcheckbox Ename="a" x="79" y="0" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Piso" U="°" V="0"/>
|
||||||
|
<CTRLcheckbox Ename="b" x="79" y="25" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="sistema de coordenadas" U="°" V="1"/>
|
||||||
|
<Objects>
|
||||||
|
<Text name="Text2" n="209" type="thin" x="windowcx-windoww+3/pixel" y="windowcy-windowh/2+25/pixel" fixed="true">Utilizar el clic derechno para hacer girar</Text>
|
||||||
|
<Expression name="E10" n="60" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-60/pixel" value="-100*windowcx" prompt="Phi" fixed="true">Expression "-100*windowcx" à -4.02299, 4.3912</Expression>
|
||||||
|
<Expression name="E11" n="61" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-90/pixel" value="100*windowcy" prompt="Theta" fixed="true">Expression "100*windowcy" à -4.02299, 3.95524</Expression>
|
||||||
|
<Expression name="a" n="210" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="0.21596738144686745" y="0.1250337471534495" value="0" prompt="Valeur">Expression "0" à 0.21597, 0.12503</Expression>
|
||||||
|
<Expression name="E9" n="59" color="1" type="thin" showname="true" showvalue="true" ctag0="superhidden" cexpr0="a==0" x="-3.339120291073775" y="3.0432051838371934" value="3" prompt="grid">Expression "3" à -3.33912, 3.04321</Expression>
|
||||||
|
<Expression name="b" n="211" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="-0.011366704286676745" y="0.06820022572006312" value="1" prompt="Valeur">Expression "1" à -0.01137, 0.0682</Expression>
|
||||||
|
<Point name="P66" n="172" color="2" hidden="true" x="windowcx-windoww-20/pixel" actx="-4.229708282523296" y="(windoww/(windoww-d(windoww)))*(y(P66)-windowcy)+windowcy+d(windowcy)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="O" n="57" type="thick" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="@b==0" x="(windoww/(windoww-d(windoww)))*(x(O)-windowcx)+windowcx+d(windowcx)" actx="0.46872564496308566" y="(windoww/(windoww-d(windoww)))*(y(O)-windowcy)+windowcy+d(windowcy)" acty="0.2810960421746347" shape="circle" is3D="true" x3D="0.0" y3D="0.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="P45" n="62" color="2" hidden="super" bold="true" large="true" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" fixed="true">Point à "x(P2)+1", "y(P2)" </Point>
|
||||||
|
<Angle name="a9" n="63" color="1" hidden="super" unit="∞" large="true" first="O" root="O" fixed="90" inverse="true">Angle O - O de mesure 90</Angle>
|
||||||
|
<Point name="P46" n="65" color="2" type="thick" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" shape="circle" fixed="true">Point sur r1 </Point>
|
||||||
|
<Expression name="E12" n="174" color="3" type="thick" hidden="true" showname="true" showvalue="true" bold="true" large="true" x="x(P66)" y="y(P66)+windoww/24" value="2" prompt="Nombre de divisions" fixed="true">Expression "2" à -4.27913, 3.24743</Expression>
|
||||||
|
<Point name="P68" n="175" color="5" hidden="super" showname="true" large="true" x="x(P66)+windoww/8" actx="-3.6684772583686094" y="y(P66)-windoww/12" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Ray name="r3" n="64" color="2" hidden="super" bold="true" large="true" from="O" to="P45">Demi-droite d'origine P44 vers P45</Ray>
|
||||||
|
<Point name="P47" n="66" color="2" hidden="super" showname="true" xcoffset="-0.05429864253393646" ycoffset="-6.742081447796977E-6" keepclose="true" bold="true" large="true" x="x(O)" actx="0.46872564496308566" y="y(O)+d(O,P46)" acty="1.2810960421746347" shape="dot" fixed="true">Point à "x(P2)", "y(P2)+d(P2,po8)" </Point>
|
||||||
|
<Segment name="s15" n="67" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P46" arrow="true">Segment de P44 à P46</Segment>
|
||||||
|
<Point name="P69" n="176" color="5" hidden="super" large="true" x="x(P68)+3*windoww" actx="9.80106732134387" y="y(P68)" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="P70" n="177" color="5" hidden="super" showname="true" large="true" x="x(P68)" actx="-3.6684772583686094" y="y(P66)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Segment name="s16" n="68" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P47" arrow="true">Segment de P44 à P47</Segment>
|
||||||
|
<Segment name="s24" n="178" color="5" hidden="super" large="true" from="P68" to="P69">Segment de P68 à P69</Segment>
|
||||||
|
<Point name="X" alias="X" n="69" color="3" type="thin" showname="true" xcoffset="-0.23757732805165954" ycoffset="-0.07533417064110326" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*sin(E10)" actx="-0.2046209206376014" y="y(O)-s16*cos(E10)*sin(E11)" acty="-0.04768789704438847" shape="dot" is3D="true" x3D="1.0" y3D="0.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*sin(a1)", "y(P2)-s6*cos(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Y" alias="Y" n="70" color="5" type="thin" showname="true" xcoffset="0.05190351386152203" ycoffset="-0.01168034001854501" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*cos(E10)" actx="1.2080526379734584" y="y(O)+s16*sin(E10)*sin(E11)" acty="-0.01834593463776646" shape="dot" is3D="true" x3D="0.0" y3D="1.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*cos(a1)", "y(P2)+s6*sin(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Z" alias="Z" n="71" color="2" type="thin" showname="true" xcoffset="-0.01669997779258381" ycoffset="0.3527600362915684" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)" actx="0.46872564496308566" y="y(O)+s16*cos(E11)" acty="1.1767721129917037" shape="dot" is3D="true" x3D="0.0" y3D="0.0" z3D="1.0" fixed="true">Point à "x(P2)", "y(P2)+s6*cos(a2)" </Point>
|
||||||
|
<Point name="P51" n="75" color="2" hidden="super" showname="true" bold="true" x="x(X)+x(O)-x(O)" actx="-0.2046209206376014" y="y(X)+y(O)-y(O)" acty="-0.04768789704438847" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a10" n="76" color="3" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" acute="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Point name="P52" n="77" color="2" hidden="super" showname="true" bold="true" x="x(Y)+x(X)-x(O)" actx="0.5347060723727712" y="y(Y)+y(X)-y(O)" acty="-0.3471298738567896" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a11" n="78" color="1" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" inverse="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Angle name="a12" n="79" color="3" hidden="super" unit="∞" large="true" first="Y" root="O" fixed="90" acute="true">Angle Y - O de mesure 90</Angle>
|
||||||
|
<Segment name="s6" n="189" color="2" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Z" is3D="true" arrow="true">Segment de O à Z</Segment>
|
||||||
|
<Segment name="s7" n="192" color="3" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="X" is3D="true" arrow="true">Segment de O à X</Segment>
|
||||||
|
<Segment name="s8" n="195" color="5" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Y" is3D="true" arrow="true">Segment de O à Y</Segment>
|
||||||
|
<Point name="P61" n="105" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.6666669271921428" y="y(O)+(E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="-1.6035817059196382" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P62" n="106" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.2707843627340285" y="y(O)+(-E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="2.165773790268908" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P63" n="107" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="-3.7692950308700937" y="y(O)+(E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.19307015495476865" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P64" n="108" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="4.706746320796265" y="y(O)+(-E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.36912192939450084" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Line name="l16" n="80" color="2" hidden="super" large="true" from="O" to="P51">Droite passant par P44 et P51</Line>
|
||||||
|
<Circle name="c4" n="24" color="2" large="true" fixed="(1+floor(4*windoww/d(P52,O)))*d(P52,O)" midpoint="O" acute="true">Cercle de centre P44 de rayon (1+floor(4*windoww/d(P52,P44)))*d(P52,P44)</Circle>
|
||||||
|
<Line name="l17" n="81" color="2" hidden="super" large="true" from="O" to="P52">Droite passant par P44 et P52</Line>
|
||||||
|
<Circle name="c5" n="26" color="1" hidden="super" large="true" fixed="E9*d(O,P52)" midpoint="O" acute="true">Cercle de centre P44 de rayon E9*d(P44,P52)</Circle>
|
||||||
|
<Polygon name="poly26" n="109" color="4" background="true" large="true" ctag0="brown" cexpr0="poly26<0" ctag1="solid" cexpr1="poly26<0" ctag2="z" cexpr2="if(poly26<0,5,10)" ctag3="superhidden" cexpr3="a==0" point1="P62" point2="P64" point3="P61" point4="P63">Polygone P62, P64, P61, P63</Polygon>
|
||||||
|
<Segment name="s23" n="113" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P64" to="P62" is3D="true">Segment de P64 à P62</Segment>
|
||||||
|
<Segment name="s20" n="110" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P62" to="P63" is3D="true">Segment de P62 à P63</Segment>
|
||||||
|
<Segment name="s21" n="111" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P63" to="P61" is3D="true">Segment de P63 à P61</Segment>
|
||||||
|
<Segment name="s22" n="112" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P61" to="P64" is3D="true">Segment de P61 à P64</Segment>
|
||||||
|
<Intersection name="I14" n="82" color="1" hidden="super" large="true" first="a11" second="c4" shape="circle" which="first">Intersection entre a11 et c4</Intersection>
|
||||||
|
<Intersection name="I15" n="83" color="3" hidden="super" large="true" first="a12" second="c4" shape="circle" which="first">Intersection entre a12 et c4</Intersection>
|
||||||
|
<Intersection name="I16" n="84" color="2" type="thick" hidden="super" showname="true" large="true" first="l17" second="c5" shape="circle" which="second">Intersection entre l17 et c5</Intersection>
|
||||||
|
<Point name="P53" n="85" color="1" hidden="super" bold="true" x="x(I14)+x(X)-x(O)" actx="-8.242358880534688" y="y(I14)+y(X)-y(O)" acty="16.413527524094512" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P54" n="86" color="3" hidden="super" bold="true" x="x(I15)+x(Y)-x(O)" actx="8.084877832826063" y="y(I15)+y(Y)-y(O)" acty="16.960644609341934" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P55" n="87" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(X)-x(O)" actx="-0.4025622028666581" y="y(I16)+y(X)-y(O)" acty="1.8369898510498843" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P56" n="88" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(Y)-x(O)" actx="1.0101113557444017" y="y(I16)+y(Y)-y(O)" acty="1.8663318134565063" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P57" n="89" color="2" type="thick" hidden="super" x="2*x(O)-x(I16)" actx="0.6666669271921424" y="2*y(O)-y(I16)" acty="-1.603581705919638" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Line name="l18" n="90" color="1" hidden="super" large="true" from="I14" to="P53">Droite passant par I14 et P53</Line>
|
||||||
|
<Line name="l19" n="91" color="3" hidden="super" large="true" from="P54" to="I15">Droite passant par P54 et I15</Line>
|
||||||
|
<Point name="P58" n="92" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P55)" actx="1.3400134927928296" y="y(P57)+y(I16)-y(P55)" acty="-1.274797766700615" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P59" n="93" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P56)" actx="-0.07266006581823037" y="y(P57)+y(I16)-y(P56)" acty="-1.304139729107237" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Line name="l20" n="94" color="1" hidden="super" large="true" from="I16" to="P55">Droite passant par I16 et P55</Line>
|
||||||
|
<Line name="l21" n="95" color="1" hidden="super" large="true" from="I16" to="P56">Droite passant par I16 et P56</Line>
|
||||||
|
<Intersection name="I17" n="96" color="1" hidden="super" showname="true" large="true" first="l17" second="l18" shape="circle">Intersection entre l17 et l18</Intersection>
|
||||||
|
<Intersection name="I18" n="97" color="3" hidden="super" showname="true" large="true" first="l17" second="l19" shape="circle">Intersection entre l17 et l19</Intersection>
|
||||||
|
<Line name="l22" n="98" color="1" hidden="super" large="true" from="P57" to="P58">Droite passant par P57 et P58</Line>
|
||||||
|
<Line name="l23" n="99" color="1" hidden="super" large="true" from="P57" to="P59">Droite passant par P57 et P59</Line>
|
||||||
|
<Point name="P60" n="100" color="5" type="thick" hidden="super" showname="true" large="true" x="if(d(O,I17)>d(O,I18),x(I17),x(I18))" actx="-1.6992668530459256" y="if(d(O,I17)>d(O,I18),y(I17),y(I18))" acty="20.923415688789024" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Intersection name="I19" n="101" color="1" hidden="super" showname="true" large="true" first="l23" second="l20" shape="circle">Intersection entre l23 et l20</Intersection>
|
||||||
|
<Intersection name="I20" n="102" color="1" hidden="super" showname="true" large="true" first="l22" second="l21" shape="circle">Intersection entre l22 et l21</Intersection>
|
||||||
|
<Function name="f24" n="103" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16))))" var="t" min="0" max="floor(((y(I20)-y(I16))/(y(P56)-y(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16)))) )</Function>
|
||||||
|
<Function name="f25" n="104" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16))))" var="t" min="0" max="floor(((x(I19)-x(I16))/(x(P55)-x(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16)))) )</Function>
|
||||||
|
</Objects>
|
||||||
|
</Construction>
|
||||||
|
</CaR>
|
101
base3D-fr-modifs.zir
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Script Name="vue d'avion" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
theta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dtheta=(90-theta)/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
theta=theta+dtheta;
|
||||||
|
SetExpressionValue("E11",theta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",90);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de face" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
theta=GetExpressionValue("E11");
|
||||||
|
dphi=-phi/200;
|
||||||
|
dtheta=-theta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
theta=theta+dtheta;
|
||||||
|
SetExpressionValue("E11",theta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",0);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de droite" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
theta=GetExpressionValue("E11");
|
||||||
|
dphi=(-90-phi)/200;
|
||||||
|
dtheta=-theta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
theta=theta+dtheta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",theta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",-90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de gauche" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
theta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dtheta=-theta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
theta=theta+dtheta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",theta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="retour en vue mobile" onload="false">
|
||||||
|
SetExpressionValue("E10","-100*windowcx");
|
||||||
|
SetExpressionValue("E11","100*windowcy");
|
||||||
|
</Script>
|
||||||
|
<Construction>
|
||||||
|
<Window x="0.42325882781637736" y="0.2640459857446189" w="4.489848193237493"/>
|
||||||
|
<Windowdim w="1280" h="800"/>
|
||||||
|
<Preferences minfontsize="13" minpointsize="3" minlinesize="1" arrowsize="15" selectionsize="5" monkeyspeed="10" gridopacity="13" digits.lengths="5" digits.edit="5" digits.angles="0" colorbackground="245,245,245" colorbackgroundx="139" colorbackgroundy="9" colorbackgroundPal="4" fig3D="true" figDP="false"/>
|
||||||
|
<CTRLcheckbox Ename="sol" x="79" y="0" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Sol" U="°" V="0"/>
|
||||||
|
<CTRLcheckbox Ename="repere" x="79" y="25" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Repère" U="°" V="1"/>
|
||||||
|
<Objects>
|
||||||
|
<Expression name="E10" n="0" color="1" type="thick" hidden="true" showname="true" showvalue="true" ctag0="superhidden" cexpr0="@b==0" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-60/pixel" value="-100*windowcx" prompt="phi" fixed="true">Expression "-100*windowcx" à -4.02299, 4.3912</Expression>
|
||||||
|
<Expression name="E11" n="1" color="1" type="thick" hidden="true" showname="true" showvalue="true" ctag0="superhidden" cexpr0="@b==0" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-90/pixel" value="100*windowcy" prompt="theta" fixed="true">Expression "100*windowcy" à -4.02299, 3.95524</Expression>
|
||||||
|
<Expression name="sol" n="2" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="0.21596738144686745" y="0.1250337471534495" value="0" prompt="Valeur">Expression "0" à 0.21597, 0.12503</Expression>
|
||||||
|
<Expression name="repere" n="3" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="-0.011366704286676745" y="0.06820022572006312" value="1" prompt="Valeur">Expression "1" à -0.01137, 0.0682</Expression>
|
||||||
|
<Expression name="grid" n="11" color="4" type="thick" hidden="true" showname="true" showvalue="true" ctag0="superhidden" cexpr0="sol==0" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-120/pixel" value="3" prompt="grid" fixed="true">Expression "3" à -4.02299, 3.51927</Expression>
|
||||||
|
<Text name="Text2" n="22" type="thin" x="windowcx-windoww+3/pixel" y="windowcy-windowh/2+25/pixel" fixed="true">Utiliser le clic-droit glisser pour faire pivoter</Text>
|
||||||
|
<Point name="O" n="4" type="thick" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" x="(windoww/(windoww-d(windoww)))*(x(O)-windowcx)+windowcx+d(windowcx)" actx="0.46872564496308566" y="(windoww/(windoww-d(windoww)))*(y(O)-windowcy)+windowcy+d(windowcy)" acty="0.2810960421746347" shape="circle" is3D="true" x3D="0.0" y3D="0.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="X" n="5" color="3" type="thin" showname="true" xcoffset="-0.23757732805165954" ycoffset="-0.07533417064110326" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" x="x(O)+sin(E10)" actx="-0.2046209206376014" y="y(O)-cos(E10)*sin(E11)" acty="-0.04768789704438847" shape="dot" is3D="true" x3D="1.0" y3D="0.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="Y" n="6" color="5" type="thin" showname="true" xcoffset="0.05190351386152203" ycoffset="-0.01168034001854501" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" x="x(O)+cos(E10)" actx="1.2080526379734584" y="y(O)+sin(E10)*sin(E11)" acty="-0.01834593463776646" shape="dot" is3D="true" x3D="0.0" y3D="1.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="Z" n="7" color="2" type="thin" showname="true" xcoffset="-0.01669997779258381" ycoffset="0.3527600362915684" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" x="x(O)" actx="0.46872564496308566" y="y(O)+cos(E11)" acty="1.1767721129917037" shape="dot" is3D="true" x3D="0.0" y3D="0.0" z3D="1.0" fixed="true">Point</Point>
|
||||||
|
<Segment name="i" n="8" color="3" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" from="O" to="X" is3D="true" arrow="true">Vecteur de O à X</Segment>
|
||||||
|
<Segment name="j" n="9" color="5" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" from="O" to="Y" is3D="true" arrow="true">Vecteur de O à Y</Segment>
|
||||||
|
<Segment name="k" n="10" color="2" ctag0="z" cexpr0="7" ctag1="superhidden" cexpr1="repere==0" from="O" to="Z" is3D="true" arrow="true">Vecteur de O à Z</Segment>
|
||||||
|
<Point name="p1" n="12" color="2" hidden="super" showname="true" bold="true" x="x(Y)+x(X)-x(O)" actx="0.5347060723727712" y="y(Y)+y(X)-y(O)" acty="-0.3471298738567896" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Circle name="c1" n="13" color="1" hidden="super" large="true" fixed="grid*d(O,p1)" midpoint="O" acute="true">Cercle de centre O de rayon grid*d(O,p1)</Circle>
|
||||||
|
<Line name="l1" n="14" color="2" hidden="super" large="true" from="O" to="p1">Droite passant par O et p1</Line>
|
||||||
|
<Intersection name="i1" n="15" color="2" type="thick" hidden="super" showname="true" large="true" first="l1" second="c1" shape="circle" which="second">Intersection entre l1 et c1</Intersection>
|
||||||
|
<Point name="p2" n="16" color="1" hidden="super" showname="true" bold="true" x="x(i1)+x(Y)-x(O)" actx="1.0101113557444017" y="y(i1)+y(Y)-y(O)" acty="1.8663318134565063" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="p3" n="17" color="1" hidden="super" showname="true" bold="true" x="x(i1)+2*grid*(x(X)-x(O))" actx="-3.769295030870093" y="y(i1)+2*grid*(y(X)-y(O))" acty="0.19307015495476842" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="p4" n="18" color="1" hidden="super" showname="true" bold="true" x="x(i1)+2*grid*(x(Y)-x(O))" actx="4.706746320796265" y="y(i1)+2*grid*(y(Y)-y(O))" acty="0.3691219293945005" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="p5" n="20" color="1" hidden="super" showname="true" bold="true" x="x(i1)+x(X)-x(O)" actx="-0.4025622028666581" y="y(i1)+y(X)-y(O)" acty="1.8369898510498843" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="p6" n="23" color="1" hidden="super" showname="true" bold="true" x="2*x(O)-x(i1)" actx="0.6666669271921424" y="2*y(O)-y(i1)" acty="-1.603581705919638" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Function name="g1" n="19" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="sol==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(i1)+(t/2)*(x(p2)-x(i1)),x(p3)+(t/2)*(x(p2)-x(i1))),if(floor((t-1)/4)==(t-1)/4,x(i1)+((t+1)/2)*(x(p2)-x(i1)),x(p3)+((t+1)/2)*(x(p2)-x(i1))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(i1)+(t/2)*(y(p2)-y(i1)),y(p3)+(t/2)*(y(p2)-y(i1))),if(floor((t-1)/4)==(t-1)/4,y(i1)+((t+1)/2)*(y(p2)-y(i1)),y(p3)+((t+1)/2)*(y(p2)-y(i1))))" var="t" min="0" max="floor(((y(p4)-y(i1))/(y(p2)-y(i1)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(i1)+(t/2)*(x(p2)-x(i1)),x(p3)+(t/2)*(x(p2)-x(i1))),if(floor((t-1)/4)==(t-1)/4,x(i1)+((t+1)/2)*(x(p2)-x(i1)),x(p3)+((t+1)/2)*(x(p2)-x(i1)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(i1)+(t/2)*(y(p2)-y(i1)),y(p3)+(t/2)*(y(p2)-y(i1))),if(floor((t-1)/4)==(t-1)/4,y(i1)+((t+1)/2)*(y(p2)-y(i1)),y(p3)+((t+1)/2)*(y(p2)-y(i1)))) )</Function>
|
||||||
|
<Function name="g2" n="21" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="sol==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(i1)+(t/2)*(x(p5)-x(i1)),x(p4)+(t/2)*(x(p5)-x(i1))),if(floor((t-1)/4)==(t-1)/4,x(i1)+((t+1)/2)*(x(p5)-x(i1)),x(p4)+((t+1)/2)*(x(p5)-x(i1))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(i1)+(t/2)*(y(p5)-y(i1)),y(p4)+(t/2)*(y(p5)-y(i1))),if(floor((t-1)/4)==(t-1)/4,y(i1)+((t+1)/2)*(y(p5)-y(i1)),y(p4)+((t+1)/2)*(y(p5)-y(i1))))" var="t" min="0" max="floor(((x(p3)-x(i1))/(x(p5)-x(i1)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(i1)+(t/2)*(x(p5)-x(i1)),x(p4)+(t/2)*(x(p5)-x(i1))),if(floor((t-1)/4)==(t-1)/4,x(i1)+((t+1)/2)*(x(p5)-x(i1)),x(p4)+((t+1)/2)*(x(p5)-x(i1)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(i1)+(t/2)*(y(p5)-y(i1)),y(p4)+(t/2)*(y(p5)-y(i1))),if(floor((t-1)/4)==(t-1)/4,y(i1)+((t+1)/2)*(y(p5)-y(i1)),y(p4)+((t+1)/2)*(y(p5)-y(i1)))) )</Function>
|
||||||
|
<Polygon name="polysol" n="24" color="4" background="true" ctag0="brown" cexpr0="polysol<0" ctag1="solid" cexpr1="polysol<0" ctag2="z" cexpr2="if(polysol<0,5,10)" ctag3="superhidden" cexpr3="sol==0" point1="i1" point2="p4" point3="p6" point4="p3">Polygone i1, p4, p6, p3</Polygon>
|
||||||
|
<Segment name="b1" n="25" color="2" large="true" ctag0="superhidden" cexpr0="sol==0" from="i1" to="p3">Segment de i1 à p3</Segment>
|
||||||
|
<Segment name="b2" n="26" color="2" large="true" ctag0="superhidden" cexpr0="sol==0" from="p3" to="p6">Segment de p3 à p6</Segment>
|
||||||
|
<Segment name="b3" n="27" color="2" large="true" ctag0="superhidden" cexpr0="sol==0" from="p6" to="p4">Segment de p6 à p4</Segment>
|
||||||
|
<Segment name="b4" n="28" color="2" large="true" ctag0="superhidden" cexpr0="sol==0" from="p4" to="i1">Segment de p4 à i1</Segment>
|
||||||
|
</Objects>
|
||||||
|
</Construction>
|
||||||
|
</CaR>
|
139
base3D-fr.zir
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Script Name="vue d'avion" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=(90-teta)/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",90);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de face" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=-phi/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",0);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de droite" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(-90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",-90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="vue de gauche" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="retour en vue mobile" onload="false">
|
||||||
|
SetExpressionValue("E10","-100*windowcx");
|
||||||
|
SetExpressionValue("E11","100*windowcy");
|
||||||
|
</Script>
|
||||||
|
<Construction>
|
||||||
|
<Window x="0.42325882781637736" y="0.2640459857446189" w="4.489848193237493"/>
|
||||||
|
<Windowdim w="1280" h="800"/>
|
||||||
|
<Preferences arrowsize="15" selectionsize="5" monkeyspeed="10" gridopacity="13" colorbackgroundx="139" colorbackgroundy="9" colorbackgroundPal="4" fig3D="true" figDP="false"/>
|
||||||
|
<CTRLcheckbox Ename="a" x="79" y="0" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Sol" U="°" V="0"/>
|
||||||
|
<CTRLcheckbox Ename="b" x="79" y="25" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Repère" U="°" V="1"/>
|
||||||
|
<Objects>
|
||||||
|
<Text name="Text2" n="209" type="thin" x="windowcx-windoww+3/pixel" y="windowcy-windowh/2+25/pixel" fixed="true">Utiliser le clic-droit glisser pour faire pivoter</Text>
|
||||||
|
<Expression name="E10" n="60" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-60/pixel" value="-100*windowcx" prompt="Phi" fixed="true">Expression "-100*windowcx" à -4.02299, 4.3912</Expression>
|
||||||
|
<Expression name="E11" n="61" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-90/pixel" value="100*windowcy" prompt="Theta" fixed="true">Expression "100*windowcy" à -4.02299, 3.95524</Expression>
|
||||||
|
<Expression name="a" n="210" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="0.21596738144686745" y="0.1250337471534495" value="0" prompt="Valeur">Expression "0" à 0.21597, 0.12503</Expression>
|
||||||
|
<Expression name="E9" n="59" color="1" type="thin" showname="true" showvalue="true" ctag0="superhidden" cexpr0="a==0" x="-3.339120291073775" y="3.0432051838371934" value="3" prompt="grid">Expression "3" à -3.33912, 3.04321</Expression>
|
||||||
|
<Expression name="b" n="211" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="-0.011366704286676745" y="0.06820022572006312" value="1" prompt="Valeur">Expression "1" à -0.01137, 0.0682</Expression>
|
||||||
|
<Point name="P66" n="172" color="2" hidden="true" x="windowcx-windoww-20/pixel" actx="-4.229708282523296" y="(windoww/(windoww-d(windoww)))*(y(P66)-windowcy)+windowcy+d(windowcy)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="O" n="57" type="thick" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="@b==0" x="(windoww/(windoww-d(windoww)))*(x(O)-windowcx)+windowcx+d(windowcx)" actx="0.46872564496308566" y="(windoww/(windoww-d(windoww)))*(y(O)-windowcy)+windowcy+d(windowcy)" acty="0.2810960421746347" shape="circle" is3D="true" x3D="0.0" y3D="0.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="P45" n="62" color="2" hidden="super" bold="true" large="true" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" fixed="true">Point à "x(P2)+1", "y(P2)" </Point>
|
||||||
|
<Angle name="a9" n="63" color="1" hidden="super" unit="∞" large="true" first="O" root="O" fixed="90" inverse="true">Angle O - O de mesure 90</Angle>
|
||||||
|
<Point name="P46" n="65" color="2" type="thick" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" shape="circle" fixed="true">Point sur r1 </Point>
|
||||||
|
<Expression name="E12" n="174" color="3" type="thick" hidden="true" showname="true" showvalue="true" bold="true" large="true" x="x(P66)" y="y(P66)+windoww/24" value="2" prompt="Nombre de divisions" fixed="true">Expression "2" à -4.22971, 3.24743</Expression>
|
||||||
|
<Point name="P68" n="175" color="5" hidden="super" showname="true" large="true" x="x(P66)+windoww/8" actx="-3.6684772583686094" y="y(P66)-windoww/12" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Ray name="r3" n="64" color="2" hidden="super" bold="true" large="true" from="O" to="P45">Demi-droite d'origine P44 vers P45</Ray>
|
||||||
|
<Point name="P47" n="66" color="2" hidden="super" showname="true" xcoffset="-0.05429864253393646" ycoffset="-6.742081447796977E-6" keepclose="true" bold="true" large="true" x="x(O)" actx="0.46872564496308566" y="y(O)+d(O,P46)" acty="1.2810960421746347" shape="dot" fixed="true">Point à "x(P2)", "y(P2)+d(P2,po8)" </Point>
|
||||||
|
<Segment name="s15" n="67" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P46" arrow="true">Segment de P44 à P46</Segment>
|
||||||
|
<Point name="P69" n="176" color="5" hidden="super" large="true" x="x(P68)+3*windoww" actx="9.80106732134387" y="y(P68)" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="P70" n="177" color="5" hidden="super" showname="true" large="true" x="x(P68)" actx="-3.6684772583686094" y="y(P66)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Segment name="s16" n="68" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P47" arrow="true">Segment de P44 à P47</Segment>
|
||||||
|
<Segment name="s24" n="178" color="5" hidden="super" large="true" from="P68" to="P69">Segment de P68 à P69</Segment>
|
||||||
|
<Point name="X" alias="X" n="69" color="3" type="thin" showname="true" xcoffset="-0.23757732805165954" ycoffset="-0.07533417064110326" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*sin(E10)" actx="-0.2046209206376014" y="y(O)-s16*cos(E10)*sin(E11)" acty="-0.04768789704438847" shape="dot" is3D="true" x3D="1.0" y3D="0.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*sin(a1)", "y(P2)-s6*cos(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Y" alias="Y" n="70" color="5" type="thin" showname="true" xcoffset="0.05190351386152203" ycoffset="-0.01168034001854501" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*cos(E10)" actx="1.2080526379734584" y="y(O)+s16*sin(E10)*sin(E11)" acty="-0.01834593463776646" shape="dot" is3D="true" x3D="0.0" y3D="1.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*cos(a1)", "y(P2)+s6*sin(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Z" alias="Z" n="71" color="2" type="thin" showname="true" xcoffset="-0.01669997779258381" ycoffset="0.3527600362915684" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)" actx="0.46872564496308566" y="y(O)+s16*cos(E11)" acty="1.1767721129917037" shape="dot" is3D="true" x3D="0.0" y3D="0.0" z3D="1.0" fixed="true">Point à "x(P2)", "y(P2)+s6*cos(a2)" </Point>
|
||||||
|
<Point name="P51" n="75" color="2" hidden="super" showname="true" bold="true" x="x(X)+x(O)-x(O)" actx="-0.2046209206376014" y="y(X)+y(O)-y(O)" acty="-0.04768789704438847" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a10" n="76" color="3" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" acute="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Point name="P52" n="77" color="2" hidden="super" showname="true" bold="true" x="x(Y)+x(X)-x(O)" actx="0.5347060723727712" y="y(Y)+y(X)-y(O)" acty="-0.3471298738567896" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a11" n="78" color="1" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" inverse="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Angle name="a12" n="79" color="3" hidden="super" unit="∞" large="true" first="Y" root="O" fixed="90" acute="true">Angle Y - O de mesure 90</Angle>
|
||||||
|
<Segment name="s6" n="189" color="2" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Z" is3D="true" arrow="true">Segment de O à Z</Segment>
|
||||||
|
<Segment name="s7" n="192" color="3" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="X" is3D="true" arrow="true">Segment de O à X</Segment>
|
||||||
|
<Segment name="s8" n="195" color="5" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Y" is3D="true" arrow="true">Segment de O à Y</Segment>
|
||||||
|
<Point name="P61" n="105" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.6666669271921428" y="y(O)+(E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="-1.6035817059196382" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P62" n="106" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.2707843627340285" y="y(O)+(-E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="2.165773790268908" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P63" n="107" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="-3.7692950308700937" y="y(O)+(E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.19307015495476865" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P64" n="108" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="4.706746320796265" y="y(O)+(-E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.36912192939450084" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Line name="l16" n="80" color="2" hidden="super" large="true" from="O" to="P51">Droite passant par P44 et P51</Line>
|
||||||
|
<Circle name="c4" n="24" color="2" large="true" fixed="(1+floor(4*windoww/d(P52,O)))*d(P52,O)" midpoint="O" acute="true">Cercle de centre P44 de rayon (1+floor(4*windoww/d(P52,P44)))*d(P52,P44)</Circle>
|
||||||
|
<Line name="l17" n="81" color="2" hidden="super" large="true" from="O" to="P52">Droite passant par P44 et P52</Line>
|
||||||
|
<Circle name="c5" n="26" color="1" hidden="super" large="true" fixed="E9*d(O,P52)" midpoint="O" acute="true">Cercle de centre P44 de rayon E9*d(P44,P52)</Circle>
|
||||||
|
<Polygon name="poly26" n="109" color="4" background="true" large="true" ctag0="brown" cexpr0="poly26<0" ctag1="solid" cexpr1="poly26<0" ctag2="z" cexpr2="if(poly26<0,5,10)" ctag3="superhidden" cexpr3="a==0" point1="P62" point2="P64" point3="P61" point4="P63">Polygone P62, P64, P61, P63</Polygon>
|
||||||
|
<Segment name="s23" n="113" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P64" to="P62" is3D="true">Segment de P64 à P62</Segment>
|
||||||
|
<Segment name="s20" n="110" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P62" to="P63" is3D="true">Segment de P62 à P63</Segment>
|
||||||
|
<Segment name="s21" n="111" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P63" to="P61" is3D="true">Segment de P63 à P61</Segment>
|
||||||
|
<Segment name="s22" n="112" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P61" to="P64" is3D="true">Segment de P61 à P64</Segment>
|
||||||
|
<Intersection name="I14" n="82" color="1" hidden="super" large="true" first="a11" second="c4" shape="circle" which="first">Intersection entre a11 et c4</Intersection>
|
||||||
|
<Intersection name="I15" n="83" color="3" hidden="super" large="true" first="a12" second="c4" shape="circle" which="first">Intersection entre a12 et c4</Intersection>
|
||||||
|
<Intersection name="I16" n="84" color="2" type="thick" hidden="super" showname="true" large="true" first="l17" second="c5" shape="circle" which="second">Intersection entre l17 et c5</Intersection>
|
||||||
|
<Point name="P53" n="85" color="1" hidden="super" bold="true" x="x(I14)+x(X)-x(O)" actx="-8.242358880534688" y="y(I14)+y(X)-y(O)" acty="16.413527524094512" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P54" n="86" color="3" hidden="super" bold="true" x="x(I15)+x(Y)-x(O)" actx="8.084877832826063" y="y(I15)+y(Y)-y(O)" acty="16.960644609341934" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P55" n="87" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(X)-x(O)" actx="-0.4025622028666581" y="y(I16)+y(X)-y(O)" acty="1.8369898510498843" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P56" n="88" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(Y)-x(O)" actx="1.0101113557444017" y="y(I16)+y(Y)-y(O)" acty="1.8663318134565063" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P57" n="89" color="2" type="thick" hidden="super" x="2*x(O)-x(I16)" actx="0.6666669271921424" y="2*y(O)-y(I16)" acty="-1.603581705919638" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Line name="l18" n="90" color="1" hidden="super" large="true" from="I14" to="P53">Droite passant par I14 et P53</Line>
|
||||||
|
<Line name="l19" n="91" color="3" hidden="super" large="true" from="P54" to="I15">Droite passant par P54 et I15</Line>
|
||||||
|
<Point name="P58" n="92" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P55)" actx="1.3400134927928296" y="y(P57)+y(I16)-y(P55)" acty="-1.274797766700615" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P59" n="93" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P56)" actx="-0.07266006581823037" y="y(P57)+y(I16)-y(P56)" acty="-1.304139729107237" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Line name="l20" n="94" color="1" hidden="super" large="true" from="I16" to="P55">Droite passant par I16 et P55</Line>
|
||||||
|
<Line name="l21" n="95" color="1" hidden="super" large="true" from="I16" to="P56">Droite passant par I16 et P56</Line>
|
||||||
|
<Intersection name="I17" n="96" color="1" hidden="super" showname="true" large="true" first="l17" second="l18" shape="circle">Intersection entre l17 et l18</Intersection>
|
||||||
|
<Intersection name="I18" n="97" color="3" hidden="super" showname="true" large="true" first="l17" second="l19" shape="circle">Intersection entre l17 et l19</Intersection>
|
||||||
|
<Line name="l22" n="98" color="1" hidden="super" large="true" from="P57" to="P58">Droite passant par P57 et P58</Line>
|
||||||
|
<Line name="l23" n="99" color="1" hidden="super" large="true" from="P57" to="P59">Droite passant par P57 et P59</Line>
|
||||||
|
<Point name="P60" n="100" color="5" type="thick" hidden="super" showname="true" large="true" x="if(d(O,I17)>d(O,I18),x(I17),x(I18))" actx="-1.6992668530459256" y="if(d(O,I17)>d(O,I18),y(I17),y(I18))" acty="20.923415688789024" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Intersection name="I19" n="101" color="1" hidden="super" showname="true" large="true" first="l23" second="l20" shape="circle">Intersection entre l23 et l20</Intersection>
|
||||||
|
<Intersection name="I20" n="102" color="1" hidden="super" showname="true" large="true" first="l22" second="l21" shape="circle">Intersection entre l22 et l21</Intersection>
|
||||||
|
<Function name="f24" n="103" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16))))" var="t" min="0" max="floor(((y(I20)-y(I16))/(y(P56)-y(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16)))) )</Function>
|
||||||
|
<Function name="f25" n="104" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16))))" var="t" min="0" max="floor(((x(I19)-x(I16))/(x(P55)-x(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16)))) )</Function>
|
||||||
|
</Objects>
|
||||||
|
</Construction>
|
||||||
|
</CaR>
|
138
base3D.zir
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Script Name="aerial view" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=(90-teta)/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",90);
|
||||||
|
</Script>
|
||||||
|
<Script Name="front view" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=-phi/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",0);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="right view" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(-90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",-90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="left view" onload="false">
|
||||||
|
phi=GetExpressionValue("E10");
|
||||||
|
teta=GetExpressionValue("E11");
|
||||||
|
dphi=(90-phi)/200;
|
||||||
|
dteta=-teta/200;
|
||||||
|
for (i=0;i<200;i++){
|
||||||
|
phi=phi+dphi;
|
||||||
|
teta=teta+dteta;
|
||||||
|
SetExpressionValue("E10",phi);
|
||||||
|
SetExpressionValue("E11",teta);
|
||||||
|
}
|
||||||
|
SetExpressionValue("E10",90);
|
||||||
|
SetExpressionValue("E11",0);
|
||||||
|
</Script>
|
||||||
|
<Script Name="back in mobile view" onload="false">
|
||||||
|
SetExpressionValue("E10","-100*windowcx");
|
||||||
|
SetExpressionValue("E11","100*windowcy");</Script>
|
||||||
|
<Construction>
|
||||||
|
<Window x="0.42325882781637736" y="0.2640459857446189" w="4.489848193237493"/>
|
||||||
|
<Windowdim w="1280" h="800"/>
|
||||||
|
<Preferences arrowsize="15" selectionsize="5" monkeyspeed="10" gridopacity="13" colorbackgroundx="139" colorbackgroundy="9" colorbackgroundPal="4" fig3D="true" figDP="false"/>
|
||||||
|
<CTRLcheckbox Ename="a" x="79" y="0" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Floor" U="°" V="0"/>
|
||||||
|
<CTRLcheckbox Ename="b" x="79" y="25" w="30" h="22" showC="true" showU="false" showV="false" hidden="false" C="Coordinates system" U="°" V="1"/>
|
||||||
|
<Objects>
|
||||||
|
<Text name="Text2" n="209" type="thin" x="windowcx-windoww+3/pixel" y="windowcy-windowh/2+25/pixel" fixed="true">Use right-clic-drag to rotate the coordinate system</Text>
|
||||||
|
<Expression name="E10" n="60" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-60/pixel" value="-100*windowcx" prompt="Phi" fixed="true">Expression "-100*windowcx" à -4.02299, 4.3912</Expression>
|
||||||
|
<Expression name="E11" n="61" color="1" type="thick" hidden="true" showname="true" showvalue="true" x="windowcx-windoww+3/pixel" y="windowcy+windowh/2-90/pixel" value="100*windowcy" prompt="Theta" fixed="true">Expression "100*windowcy" à -4.02299, 3.95524</Expression>
|
||||||
|
<Expression name="a" n="210" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="0.21596738144686745" y="0.1250337471534495" value="0" prompt="Valeur">Expression "0" à 0.21597, 0.12503</Expression>
|
||||||
|
<Expression name="E9" n="59" color="1" type="thin" showname="true" showvalue="true" ctag0="superhidden" cexpr0="a==0" x="-3.339120291073775" y="3.0432051838371934" value="3" prompt="grid">Expression "3" à -3.33912, 3.04321</Expression>
|
||||||
|
<Expression name="b" n="211" color="1" type="thick" hidden="super" showname="true" showvalue="true" x="-0.011366704286676745" y="0.06820022572006312" value="1" prompt="Valeur">Expression "1" à -0.01137, 0.0682</Expression>
|
||||||
|
<Point name="P66" n="172" color="2" hidden="true" x="windowcx-windoww-20/pixel" actx="-4.229708282523296" y="(windoww/(windoww-d(windoww)))*(y(P66)-windowcy)+windowcy+d(windowcy)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="O" n="57" type="thick" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="@b==0" x="(windoww/(windoww-d(windoww)))*(x(O)-windowcx)+windowcx+d(windowcx)" actx="0.46872564496308566" y="(windoww/(windoww-d(windoww)))*(y(O)-windowcy)+windowcy+d(windowcy)" acty="0.2810960421746347" shape="circle" is3D="true" x3D="0.0" y3D="0.0" z3D="0.0" fixed="true">Point</Point>
|
||||||
|
<Point name="P45" n="62" color="2" hidden="super" bold="true" large="true" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" fixed="true">Point à "x(P2)+1", "y(P2)" </Point>
|
||||||
|
<Angle name="a9" n="63" color="1" hidden="super" unit="∞" large="true" first="O" root="O" fixed="90" inverse="true">Angle O - O de mesure 90</Angle>
|
||||||
|
<Point name="P46" n="65" color="2" type="thick" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" x="x(O)+1" actx="1.4687256449630857" y="y(O)" acty="0.2810960421746347" shape="circle" fixed="true">Point sur r1 </Point>
|
||||||
|
<Expression name="E12" n="174" color="3" type="thick" hidden="true" showname="true" showvalue="true" bold="true" large="true" x="x(P66)" y="y(P66)+windoww/24" value="2" prompt="Nombre de divisions" fixed="true">Expression "2" à -4.27913, 3.24743</Expression>
|
||||||
|
<Point name="P68" n="175" color="5" hidden="super" showname="true" large="true" x="x(P66)+windoww/8" actx="-3.6684772583686094" y="y(P66)-windoww/12" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Ray name="r3" n="64" color="2" hidden="super" bold="true" large="true" from="O" to="P45">Demi-droite d'origine P44 vers P45</Ray>
|
||||||
|
<Point name="P47" n="66" color="2" hidden="super" showname="true" xcoffset="-0.05429864253393646" ycoffset="-6.742081447796977E-6" keepclose="true" bold="true" large="true" x="x(O)" actx="0.46872564496308566" y="y(O)+d(O,P46)" acty="1.2810960421746347" shape="dot" fixed="true">Point à "x(P2)", "y(P2)+d(P2,po8)" </Point>
|
||||||
|
<Segment name="s15" n="67" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P46" arrow="true">Segment de P44 à P46</Segment>
|
||||||
|
<Point name="P69" n="176" color="5" hidden="super" large="true" x="x(P68)+3*windoww" actx="9.80106732134387" y="y(P68)" acty="2.6862009320964266" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Point name="P70" n="177" color="5" hidden="super" showname="true" large="true" x="x(P68)" actx="-3.6684772583686094" y="y(P66)" acty="3.060354948199551" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Segment name="s16" n="68" color="2" hidden="super" bold="true" large="true" ctag0="z" cexpr0="7" from="O" to="P47" arrow="true">Segment de P44 à P47</Segment>
|
||||||
|
<Segment name="s24" n="178" color="5" hidden="super" large="true" from="P68" to="P69">Segment de P68 à P69</Segment>
|
||||||
|
<Point name="X" alias="X" n="69" color="3" type="thin" showname="true" xcoffset="-0.23757732805165954" ycoffset="-0.07533417064110326" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*sin(E10)" actx="-0.2046209206376014" y="y(O)-s16*cos(E10)*sin(E11)" acty="-0.04768789704438847" shape="dot" is3D="true" x3D="1.0" y3D="0.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*sin(a1)", "y(P2)-s6*cos(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Y" alias="Y" n="70" color="5" type="thin" showname="true" xcoffset="0.05190351386152203" ycoffset="-0.01168034001854501" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)+s15*cos(E10)" actx="1.2080526379734584" y="y(O)+s16*sin(E10)*sin(E11)" acty="-0.01834593463776646" shape="dot" is3D="true" x3D="0.0" y3D="1.0" z3D="0.0" fixed="true">Point à "x(P2)+s5*cos(a1)", "y(P2)+s6*sin(a1)*sin(a2)" </Point>
|
||||||
|
<Point name="Z" alias="Z" n="71" color="2" type="thin" showname="true" xcoffset="-0.01669997779258381" ycoffset="0.3527600362915684" keepclose="true" bold="true" large="true" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" x="x(O)" actx="0.46872564496308566" y="y(O)+s16*cos(E11)" acty="1.1767721129917037" shape="dot" is3D="true" x3D="0.0" y3D="0.0" z3D="1.0" fixed="true">Point à "x(P2)", "y(P2)+s6*cos(a2)" </Point>
|
||||||
|
<Point name="P51" n="75" color="2" hidden="super" showname="true" bold="true" x="x(X)+x(O)-x(O)" actx="-0.2046209206376014" y="y(X)+y(O)-y(O)" acty="-0.04768789704438847" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a10" n="76" color="3" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" acute="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Point name="P52" n="77" color="2" hidden="super" showname="true" bold="true" x="x(Y)+x(X)-x(O)" actx="0.5347060723727712" y="y(Y)+y(X)-y(O)" acty="-0.3471298738567896" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Angle name="a11" n="78" color="1" hidden="super" unit="∞" large="true" first="X" root="O" fixed="90" inverse="true">Angle X - O de mesure 90</Angle>
|
||||||
|
<Angle name="a12" n="79" color="3" hidden="super" unit="∞" large="true" first="Y" root="O" fixed="90" acute="true">Angle Y - O de mesure 90</Angle>
|
||||||
|
<Segment name="s6" n="189" color="2" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Z" is3D="true" arrow="true">Segment de O à Z</Segment>
|
||||||
|
<Segment name="s7" n="192" color="3" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="X" is3D="true" arrow="true">Segment de O à X</Segment>
|
||||||
|
<Segment name="s8" n="195" color="5" ctag0="z" cexpr0="7" ctag1="hidden" cexpr1="b==0" from="O" to="Y" is3D="true" arrow="true">Segment de O à Y</Segment>
|
||||||
|
<Point name="P61" n="105" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.6666669271921428" y="y(O)+(E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="-1.6035817059196382" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P62" n="106" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="0.2707843627340285" y="y(O)+(-E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="2.165773790268908" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P63" n="107" color="1" type="thick" hidden="super" large="true" x="x(O)+(E9)*(x(X)-x(O))+(-E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="-3.7692950308700937" y="y(O)+(E9)*(y(X)-y(O))+(-E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.19307015495476865" shape="circle" is3D="true" x3D="E9" actx3D="3.0" y3D="-E9" acty3D="-3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Point name="P64" n="108" color="1" type="thick" hidden="super" large="true" x="x(O)+(-E9)*(x(X)-x(O))+(E9)*(x(Y)-x(O))+(0)*(x(Z)-x(O))" actx="4.706746320796265" y="y(O)+(-E9)*(y(X)-y(O))+(E9)*(y(Y)-y(O))+(0)*(y(Z)-y(O))" acty="0.36912192939450084" shape="circle" is3D="true" x3D="-E9" actx3D="-3.0" y3D="E9" acty3D="3.0" z3D="0" actz3D="0.0" fixed="true" fixed3D="true">Point</Point>
|
||||||
|
<Line name="l16" n="80" color="2" hidden="super" large="true" from="O" to="P51">Droite passant par P44 et P51</Line>
|
||||||
|
<Circle name="c4" n="24" color="2" large="true" fixed="(1+floor(4*windoww/d(P52,O)))*d(P52,O)" midpoint="O" acute="true">Cercle de centre P44 de rayon (1+floor(4*windoww/d(P52,P44)))*d(P52,P44)</Circle>
|
||||||
|
<Line name="l17" n="81" color="2" hidden="super" large="true" from="O" to="P52">Droite passant par P44 et P52</Line>
|
||||||
|
<Circle name="c5" n="26" color="1" hidden="super" large="true" fixed="E9*d(O,P52)" midpoint="O" acute="true">Cercle de centre P44 de rayon E9*d(P44,P52)</Circle>
|
||||||
|
<Polygon name="poly26" n="109" color="4" background="true" large="true" ctag0="brown" cexpr0="poly26<0" ctag1="solid" cexpr1="poly26<0" ctag2="z" cexpr2="if(poly26<0,5,10)" ctag3="superhidden" cexpr3="a==0" point1="P62" point2="P64" point3="P61" point4="P63">Polygone P62, P64, P61, P63</Polygon>
|
||||||
|
<Segment name="s23" n="113" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P64" to="P62" is3D="true">Segment de P64 à P62</Segment>
|
||||||
|
<Segment name="s20" n="110" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P62" to="P63" is3D="true">Segment de P62 à P63</Segment>
|
||||||
|
<Segment name="s21" n="111" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P63" to="P61" is3D="true">Segment de P63 à P61</Segment>
|
||||||
|
<Segment name="s22" n="112" color="2" large="true" ctag0="superhidden" cexpr0="a==0" from="P61" to="P64" is3D="true">Segment de P61 à P64</Segment>
|
||||||
|
<Intersection name="I14" n="82" color="1" hidden="super" large="true" first="a11" second="c4" shape="circle" which="first">Intersection entre a11 et c4</Intersection>
|
||||||
|
<Intersection name="I15" n="83" color="3" hidden="super" large="true" first="a12" second="c4" shape="circle" which="first">Intersection entre a12 et c4</Intersection>
|
||||||
|
<Intersection name="I16" n="84" color="2" type="thick" hidden="super" showname="true" large="true" first="l17" second="c5" shape="circle" which="second">Intersection entre l17 et c5</Intersection>
|
||||||
|
<Point name="P53" n="85" color="1" hidden="super" bold="true" x="x(I14)+x(X)-x(O)" actx="-8.242358880534688" y="y(I14)+y(X)-y(O)" acty="16.413527524094512" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P54" n="86" color="3" hidden="super" bold="true" x="x(I15)+x(Y)-x(O)" actx="8.084877832826063" y="y(I15)+y(Y)-y(O)" acty="16.960644609341934" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P55" n="87" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(X)-x(O)" actx="-0.4025622028666581" y="y(I16)+y(X)-y(O)" acty="1.8369898510498843" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P56" n="88" color="1" hidden="super" showname="true" bold="true" x="x(I16)+x(Y)-x(O)" actx="1.0101113557444017" y="y(I16)+y(Y)-y(O)" acty="1.8663318134565063" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P57" n="89" color="2" type="thick" hidden="super" x="2*x(O)-x(I16)" actx="0.6666669271921424" y="2*y(O)-y(I16)" acty="-1.603581705919638" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Line name="l18" n="90" color="1" hidden="super" large="true" from="I14" to="P53">Droite passant par I14 et P53</Line>
|
||||||
|
<Line name="l19" n="91" color="3" hidden="super" large="true" from="P54" to="I15">Droite passant par P54 et I15</Line>
|
||||||
|
<Point name="P58" n="92" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P55)" actx="1.3400134927928296" y="y(P57)+y(I16)-y(P55)" acty="-1.274797766700615" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Point name="P59" n="93" color="2" type="thick" hidden="super" bold="true" x="x(P57)+x(I16)-x(P56)" actx="-0.07266006581823037" y="y(P57)+y(I16)-y(P56)" acty="-1.304139729107237" shape="circle" fixed="true">Point à "x(C)+x(B)-x(A)", "y(C)+y(B)-y(A)" </Point>
|
||||||
|
<Line name="l20" n="94" color="1" hidden="super" large="true" from="I16" to="P55">Droite passant par I16 et P55</Line>
|
||||||
|
<Line name="l21" n="95" color="1" hidden="super" large="true" from="I16" to="P56">Droite passant par I16 et P56</Line>
|
||||||
|
<Intersection name="I17" n="96" color="1" hidden="super" showname="true" large="true" first="l17" second="l18" shape="circle">Intersection entre l17 et l18</Intersection>
|
||||||
|
<Intersection name="I18" n="97" color="3" hidden="super" showname="true" large="true" first="l17" second="l19" shape="circle">Intersection entre l17 et l19</Intersection>
|
||||||
|
<Line name="l22" n="98" color="1" hidden="super" large="true" from="P57" to="P58">Droite passant par P57 et P58</Line>
|
||||||
|
<Line name="l23" n="99" color="1" hidden="super" large="true" from="P57" to="P59">Droite passant par P57 et P59</Line>
|
||||||
|
<Point name="P60" n="100" color="5" type="thick" hidden="super" showname="true" large="true" x="if(d(O,I17)>d(O,I18),x(I17),x(I18))" actx="-1.6992668530459256" y="if(d(O,I17)>d(O,I18),y(I17),y(I18))" acty="20.923415688789024" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Intersection name="I19" n="101" color="1" hidden="super" showname="true" large="true" first="l23" second="l20" shape="circle">Intersection entre l23 et l20</Intersection>
|
||||||
|
<Intersection name="I20" n="102" color="1" hidden="super" showname="true" large="true" first="l22" second="l21" shape="circle">Intersection entre l22 et l21</Intersection>
|
||||||
|
<Function name="f24" n="103" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16))))" var="t" min="0" max="floor(((y(I20)-y(I16))/(y(P56)-y(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P56)-x(I16)),x(I19)+(t/2)*(x(P56)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P56)-x(I16)),x(I19)+((t+1)/2)*(x(P56)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P56)-y(I16)),y(I19)+(t/2)*(y(P56)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P56)-y(I16)),y(I19)+((t+1)/2)*(y(P56)-y(I16)))) )</Function>
|
||||||
|
<Function name="f25" n="104" color="1" type="thin" large="true" ctag0="z" cexpr0="9" ctag1="superhidden" cexpr1="a==0" x="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16))))" y="if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16))))" var="t" min="0" max="floor(((x(I19)-x(I16))/(x(P55)-x(I16)))*2)-1" d="1" shape="cross" color="1">Fonction ( if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),x(I16)+(t/2)*(x(P55)-x(I16)),x(I20)+(t/2)*(x(P55)-x(I16))),if(floor((t-1)/4)==(t-1)/4,x(I16)+((t+1)/2)*(x(P55)-x(I16)),x(I20)+((t+1)/2)*(x(P55)-x(I16)))) , if(floor(t/2)==(t/2),if(floor(t/4)==(t/4),y(I16)+(t/2)*(y(P55)-y(I16)),y(I20)+(t/2)*(y(P55)-y(I16))),if(floor((t-1)/4)==(t-1)/4,y(I16)+((t+1)/2)*(y(P55)-y(I16)),y(I20)+((t+1)/2)*(y(P55)-y(I16)))) )</Function>
|
||||||
|
</Objects>
|
||||||
|
</Construction>
|
||||||
|
</CaR>
|
13
baseDP.zir
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Construction>
|
||||||
|
<Window x="0.0" y="0.0" w="8.0"/>
|
||||||
|
<Windowdim w="1280" h="800"/>
|
||||||
|
<Preferences minfontsize="13" minpointsize="3" minlinesize="1" arrowsize="15" digits.lengths="5" digits.edit="5" digits.angles="0" colorbackground="3,60,126" colorbackgroundx="79" colorbackgroundy="128" colorbackgroundPal="4" fig3D="false"/>
|
||||||
|
<Objects>
|
||||||
|
<Point name="CH" n="0" color="2" hidden="true" showname="true" x="0" actx="0.0" y="0" acty="0.0" shape="circle" fixed="true">Point</Point>
|
||||||
|
<Circle name="Hz" n="3" color="3" type="thick" hidden="true" ctag0="z" cexpr0="0" fixed="4" midpoint="CH" acute="true">Cercle de centre P1 de rayon 4.0</Circle>
|
||||||
|
<Circle name="HzBack" n="7" color="4" scolor="245,245,245" type="thin" hidden="super" solid="true" ctag0="z" cexpr0="1" fixed="Hz-0.0010/pixel" midpoint="CH" filled="true" acute="true">Cercle de centre CH de rayon 0.8387572301991061</Circle>
|
||||||
|
</Objects>
|
||||||
|
</Construction>
|
||||||
|
</CaR>
|
1446
builtin.mcr
Normal file
50
com/apple/eawt/Application.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Application.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public class Application {
|
||||||
|
public Application() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addApplicationListener(final ApplicationListener listenToMe) {
|
||||||
|
// I don't feel like listening today!!
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getEnabledPreferencesMenu() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeApplicationListener(
|
||||||
|
final ApplicationListener dontListenToMe) {
|
||||||
|
// don't worry I haven't been
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEneablePreferencesMenu(final boolean enable) {
|
||||||
|
// yeah, like, what-ever!
|
||||||
|
}
|
||||||
|
|
||||||
|
public static java.awt.Point getMouseLocationOnScreen() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
50
com/apple/eawt/ApplicationAdapter.java
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* ApplicationAdapter.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public class ApplicationAdapter implements ApplicationListener {
|
||||||
|
public ApplicationAdapter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleAbout(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleOpenApplication(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleOpenFile(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePreferences(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handlePrintFile(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleQuit(final ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleReOpenApplication(ApplicationEvent event) {
|
||||||
|
}
|
||||||
|
}
|
39
com/apple/eawt/ApplicationBeanInfo.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* ApplicationBeanInfo.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public class ApplicationBeanInfo extends java.beans.SimpleBeanInfo {
|
||||||
|
public ApplicationBeanInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param iconKind
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public java.awt.Image getIcon(final int iconKind) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
37
com/apple/eawt/ApplicationEvent.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* ApplicationEvent.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public class ApplicationEvent {
|
||||||
|
public java.lang.String getFilename() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHandled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHandled(final boolean state) {
|
||||||
|
}
|
||||||
|
}
|
38
com/apple/eawt/ApplicationListener.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* ApplicationListener.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public interface ApplicationListener extends java.util.EventListener {
|
||||||
|
public void handleAbout(ApplicationEvent event);
|
||||||
|
|
||||||
|
public void handleOpenApplication(ApplicationEvent event);
|
||||||
|
|
||||||
|
public void handleOpenFile(ApplicationEvent event);
|
||||||
|
|
||||||
|
public void handlePreferences(ApplicationEvent event);
|
||||||
|
|
||||||
|
public void handlePrintFile(ApplicationEvent event);
|
||||||
|
|
||||||
|
public void handleQuit(ApplicationEvent event);
|
||||||
|
}
|
56
com/apple/eawt/CocoaComponent.java
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* CocoaComponent.java
|
||||||
|
* allusionsApp
|
||||||
|
*
|
||||||
|
* Created by Matthieu Cormier on Fri Jun 20 2003.
|
||||||
|
*
|
||||||
|
* 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 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.apple.eawt;
|
||||||
|
|
||||||
|
// This is a stub interface for non Mac OS X java 1.4 environments
|
||||||
|
|
||||||
|
public abstract class CocoaComponent extends java.awt.Canvas {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public CocoaComponent() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int createNSView();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract java.awt.Dimension getMaximumSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public abstract java.awt.Dimension getMinimumSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public abstract java.awt.Dimension getPreferredSize();
|
||||||
|
|
||||||
|
public void sendMessage(final int messageID, final java.lang.Object message) {
|
||||||
|
}
|
||||||
|
}
|
103
de/erichseifert/vectorgraphics2d/DataUtils.java
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class that contains utility functions for working with data
|
||||||
|
* collections like maps or lists.
|
||||||
|
*/
|
||||||
|
public abstract class DataUtils {
|
||||||
|
/**
|
||||||
|
* Default constructor that prevents creation of class.
|
||||||
|
*/
|
||||||
|
protected DataUtils() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a mapping from two arrays, one with keys, one with values.
|
||||||
|
* @param <K> Data type of the keys.
|
||||||
|
* @param <V> Data type of the values.
|
||||||
|
* @param keys Array containing the keys.
|
||||||
|
* @param values Array containing the values.
|
||||||
|
* @return Map with keys and values from the specified arrays.
|
||||||
|
*/
|
||||||
|
public static <K,V> Map<K, V> map(K[] keys, V[] values) {
|
||||||
|
// Check for valid parameters
|
||||||
|
if (keys.length != values.length) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Number of keys and values is different. " +
|
||||||
|
"Cannot create map.");
|
||||||
|
}
|
||||||
|
// Fill map with keys and values
|
||||||
|
Map<K, V> map = new HashMap<K, V>();
|
||||||
|
for (int i = 0; i < keys.length; i++) {
|
||||||
|
K key = keys[i];
|
||||||
|
V value = values[i];
|
||||||
|
map.put(key, value);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string with all float values divided by a specified separator.
|
||||||
|
* @param separator Separator string.
|
||||||
|
* @param elements Float array.
|
||||||
|
* @return Joined string.
|
||||||
|
*/
|
||||||
|
public static String join(String separator, float... elements) {
|
||||||
|
if (elements == null || elements.length == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
StringBuffer sb = new StringBuffer(elements.length*3);
|
||||||
|
for (int i = 0; i < elements.length; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(separator);
|
||||||
|
}
|
||||||
|
sb.append(elements[i]);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string with all float values divided by a specified separator.
|
||||||
|
* @param separator Separator string.
|
||||||
|
* @param elements Double array.
|
||||||
|
* @return Joined string.
|
||||||
|
*/
|
||||||
|
public static String join(String separator, double... elements) {
|
||||||
|
if (elements == null || elements.length == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
StringBuffer sb = new StringBuffer(elements.length*3);
|
||||||
|
for (int i = 0; i < elements.length; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(separator);
|
||||||
|
}
|
||||||
|
sb.append(elements[i]);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
459
de/erichseifert/vectorgraphics2d/EPSGraphics2D.java
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.Stroke;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Arc2D;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Line2D;
|
||||||
|
import java.awt.geom.PathIterator;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>Graphics2D</code> implementation that saves all operations to a string
|
||||||
|
* in the <i>Encapsulated PostScript®</i> (EPS) format.
|
||||||
|
*/
|
||||||
|
public class EPSGraphics2D extends VectorGraphics2D {
|
||||||
|
/** Constant to convert values from millimeters to PostScript® units
|
||||||
|
(1/72th inch). */
|
||||||
|
// protected static final double MM_IN_UNITS = 72.0 / 25.4;
|
||||||
|
protected static final double MM_IN_UNITS = 1.0;
|
||||||
|
|
||||||
|
/** Mapping of stroke endcap values from Java to PostScript®. */
|
||||||
|
private static final Map<Integer, Integer> STROKE_ENDCAPS = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE },
|
||||||
|
new Integer[] { 0, 1, 2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Mapping of line join values for path drawing from Java to
|
||||||
|
PostScript®. */
|
||||||
|
private static final Map<Integer, Integer> STROKE_LINEJOIN = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL },
|
||||||
|
new Integer[] { 0, 1, 2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor that initializes a new <code>EPSGraphics2D</code> instance.
|
||||||
|
* The document dimension must be specified as parameters.
|
||||||
|
*/
|
||||||
|
public EPSGraphics2D(double x, double y, double width, double height) {
|
||||||
|
super(x, y, width, height);
|
||||||
|
writeHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeString(String str, double x, double y) {
|
||||||
|
// Escape string
|
||||||
|
str = str.replaceAll("\\\\", "\\\\\\\\").replaceAll("\t", "\\\\t")
|
||||||
|
.replaceAll("\b", "\\\\b").replaceAll("\f", "\\\\f")
|
||||||
|
.replaceAll("\\(", "\\\\(").replaceAll("\\)", "\\\\)");
|
||||||
|
|
||||||
|
//float fontSize = getFont().getSize2D();
|
||||||
|
//float leading = getFont().getLineMetrics("", getFontRenderContext())
|
||||||
|
// .getLeading();
|
||||||
|
|
||||||
|
write("gsave 1 -1 scale ");
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Extract lines
|
||||||
|
String[] lines = str.replaceAll("\r\n", "\n").replaceAll("\r", "\n")
|
||||||
|
.split("\n");
|
||||||
|
// Output lines
|
||||||
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
String line = lines[i];
|
||||||
|
write(x, " -", y + i*fontSize + ((i>0) ? leading : 0f),
|
||||||
|
" M (", line, ") show ");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
str = str.replaceAll("[\r\n]", "");
|
||||||
|
write(x, " -", y, " M (", str, ") show ");
|
||||||
|
|
||||||
|
writeln("grestore");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStroke(Stroke s) {
|
||||||
|
BasicStroke bsPrev;
|
||||||
|
if (getStroke() instanceof BasicStroke) {
|
||||||
|
bsPrev = (BasicStroke) getStroke();
|
||||||
|
} else {
|
||||||
|
bsPrev = new BasicStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setStroke(s);
|
||||||
|
|
||||||
|
if (s instanceof BasicStroke) {
|
||||||
|
BasicStroke bs = (BasicStroke) s;
|
||||||
|
if (bs.getLineWidth() != bsPrev.getLineWidth()) {
|
||||||
|
writeln(bs.getLineWidth(), " setlinewidth");
|
||||||
|
}
|
||||||
|
if (bs.getLineJoin() != bsPrev.getLineJoin()) {
|
||||||
|
writeln(STROKE_LINEJOIN.get(bs.getLineJoin()), " setlinejoin");
|
||||||
|
}
|
||||||
|
if (bs.getEndCap() != bsPrev.getEndCap()) {
|
||||||
|
writeln(STROKE_ENDCAPS.get(bs.getEndCap()), " setlinecap");
|
||||||
|
}
|
||||||
|
if ((!Arrays.equals(bs.getDashArray(), bsPrev.getDashArray())) ||
|
||||||
|
(bs.getDashPhase() != bsPrev.getDashPhase())) {
|
||||||
|
writeln("[", DataUtils.join(" ", bs.getDashArray()), "] ",
|
||||||
|
bs.getDashPhase(), " setdash");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeImage(Image img, int imgWidth, int imgHeight,
|
||||||
|
double x, double y, double width, double height) {
|
||||||
|
BufferedImage bufferedImg = GraphicsUtils.toBufferedImage(img);
|
||||||
|
String imgData = getEps(bufferedImg);
|
||||||
|
int bands = bufferedImg.getSampleModel().getNumBands();
|
||||||
|
int bitsPerPixel = (int) Math.ceil(
|
||||||
|
bufferedImg.getColorModel().getPixelSize() / 8.0) * 8;
|
||||||
|
int bitsPerSample = bitsPerPixel / bands;
|
||||||
|
if (bands > 3) {
|
||||||
|
bands = 3;
|
||||||
|
}
|
||||||
|
writeln("gsave");
|
||||||
|
writeln(x, " ", y, " ", width, " ", height, " ",
|
||||||
|
imgWidth, " ", imgHeight, " ", bitsPerSample, " img false ", bands,
|
||||||
|
" colorimage"
|
||||||
|
);
|
||||||
|
writeln(imgData, ">");
|
||||||
|
writeln("grestore");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color c) {
|
||||||
|
Color color = getColor();
|
||||||
|
if (c != null) {
|
||||||
|
super.setColor(c);
|
||||||
|
// TODO Add transparency hints for PDF conversion?
|
||||||
|
/*if (color.getAlpha() != c.getAlpha()) {
|
||||||
|
double a = c.getAlpha()/255.0;
|
||||||
|
writeln("[ /ca ", a, " /SetTransparency pdfmark");
|
||||||
|
}*/
|
||||||
|
if (color.getRed() != c.getRed() || color.getGreen() != c.getGreen()
|
||||||
|
|| color.getBlue() != c.getBlue()) {
|
||||||
|
double r = c.getRed()/255.0;
|
||||||
|
double g = c.getGreen()/255.0;
|
||||||
|
double b = c.getBlue()/255.0;
|
||||||
|
writeln(r, " ", g, " ", b, " rgb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFont(Font font) {
|
||||||
|
if (!getFont().equals(font)) {
|
||||||
|
super.setFont(font);
|
||||||
|
writeln("/", font.getPSName(), " ", font.getSize2D(),
|
||||||
|
" selectfont");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClip(Shape clip) {
|
||||||
|
if (getClip() != null) {
|
||||||
|
writeln("cliprestore");
|
||||||
|
}
|
||||||
|
super.setClip(clip);
|
||||||
|
if (getClip() != null) {
|
||||||
|
writeShape(getClip());
|
||||||
|
writeln(" clip");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTransform(AffineTransform tx) {
|
||||||
|
if (getTransform().equals(tx)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.setTransform(tx);
|
||||||
|
double[] matrix = new double[6];
|
||||||
|
getTransform().getMatrix(matrix);
|
||||||
|
writeln("basematrix setmatrix [", DataUtils.join(" ", matrix),
|
||||||
|
"] concat");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void translate(double tx, double ty) {
|
||||||
|
super.translate(tx, ty);
|
||||||
|
if ((tx != 0.0) || (ty != 0.0)) {
|
||||||
|
writeln(tx, " ", ty, " translate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scale(double sx, double sy) {
|
||||||
|
super.scale(sx, sy);
|
||||||
|
if ((sx != 1.0) || (sy != 1.0)) {
|
||||||
|
writeln(sx, " ", sy, " scale");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(double theta) {
|
||||||
|
super.rotate(theta);
|
||||||
|
if (theta != 0.0) {
|
||||||
|
writeln(theta/Math.PI*180.0, " rotate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(double theta, double x, double y) {
|
||||||
|
super.rotate(theta, x, y);
|
||||||
|
if (theta != 0.0) {
|
||||||
|
writeln(x, " ", y, " translate ", theta/Math.PI*180.0, " rotate ",
|
||||||
|
-x, " ", -y, " translate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shear(double sx, double sy) {
|
||||||
|
super.shear(sx, sy);
|
||||||
|
if ((sx != 0.0) || (sy != 0.0)) {
|
||||||
|
setTransform(getTransform());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeHeader() {
|
||||||
|
Rectangle2D bounds = getBounds();
|
||||||
|
double x = bounds.getX() * MM_IN_UNITS;
|
||||||
|
double y = bounds.getY() * MM_IN_UNITS;
|
||||||
|
double w = bounds.getWidth() * MM_IN_UNITS;
|
||||||
|
double h = bounds.getHeight() * MM_IN_UNITS;
|
||||||
|
|
||||||
|
writeln("%!PS-Adobe-3.0 EPSF-3.0");
|
||||||
|
writeln("%%BoundingBox: ",
|
||||||
|
(int) Math.floor(x), " ", (int) Math.floor(y), " ",
|
||||||
|
(int) Math.ceil(x + w), " ", (int) Math.ceil(y + h));
|
||||||
|
writeln("%%HiResBoundingBox: ", x, " ", y, " ", x + w, " ", y + h);
|
||||||
|
writeln("%%LanguageLevel: 3");
|
||||||
|
writeln("%%Pages: 1");
|
||||||
|
writeln("%%Page: 1 1");
|
||||||
|
|
||||||
|
// Utility functions
|
||||||
|
writeln("/M /moveto load def");
|
||||||
|
writeln("/L /lineto load def");
|
||||||
|
writeln("/C /curveto load def");
|
||||||
|
writeln("/Z /closepath load def");
|
||||||
|
writeln("/RL /rlineto load def");
|
||||||
|
writeln("/rgb /setrgbcolor load def");
|
||||||
|
writeln("/rect { ",
|
||||||
|
"/height exch def /width exch def /y exch def /x exch def ",
|
||||||
|
"x y M width 0 RL 0 height RL width neg 0 RL ",
|
||||||
|
"} bind def");
|
||||||
|
writeln("/ellipse { ",
|
||||||
|
"/endangle exch def /startangle exch def ",
|
||||||
|
"/ry exch def /rx exch def /y exch def /x exch def ",
|
||||||
|
"/savematrix matrix currentmatrix def ",
|
||||||
|
"x y translate rx ry scale 0 0 1 startangle endangle arcn ",
|
||||||
|
"savematrix setmatrix ",
|
||||||
|
"} bind def");
|
||||||
|
writeln("/img { ",
|
||||||
|
"/bits exch def /imgheight exch def /imgwidth exch def ",
|
||||||
|
"/height exch def /width exch def /y exch def /x exch def ",
|
||||||
|
"x y translate width height scale ",
|
||||||
|
"imgwidth imgheight bits [imgwidth 0 0 imgheight 0 0] currentfile ",
|
||||||
|
"/ASCIIHexDecode filter ",
|
||||||
|
"} bind def");
|
||||||
|
// Set default font
|
||||||
|
writeln("/", getFont().getPSName(), " ", getFont().getSize2D(),
|
||||||
|
" selectfont");
|
||||||
|
//writeln("<< /AllowTransparency true >> setdistillerparams"); // TODO
|
||||||
|
// Save state
|
||||||
|
writeln("gsave");
|
||||||
|
// Save state
|
||||||
|
writeln("clipsave");
|
||||||
|
// Settings
|
||||||
|
writeln("/DeviceRGB setcolorspace");
|
||||||
|
// Adjust page size and page origin
|
||||||
|
writeln("0 ", h, " translate");
|
||||||
|
writeln(MM_IN_UNITS, " -", MM_IN_UNITS, " scale");
|
||||||
|
writeln("/basematrix matrix currentmatrix def");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing a tag closing fragment for drawing operations.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeClosingDraw(Shape s) {
|
||||||
|
writeln(" stroke");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing a tag closing fragment for filling operations.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeClosingFill(Shape s) {
|
||||||
|
// TODO Omit fill operation if paint isn't a Color object
|
||||||
|
writeln(" fill");
|
||||||
|
if (!(getPaint() instanceof Color)) {
|
||||||
|
super.writeClosingFill(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing an arbitrary shape to.
|
||||||
|
* It tries to translate Java2D shapes to the corresponding EPS shape
|
||||||
|
* commands.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeShape(Shape s) {
|
||||||
|
write("newpath ");
|
||||||
|
if (s instanceof Line2D) {
|
||||||
|
Line2D l = (Line2D) s;
|
||||||
|
double x1 = l.getX1();
|
||||||
|
double y1 = l.getY1();
|
||||||
|
double x2 = l.getX2();
|
||||||
|
double y2 = l.getY2();
|
||||||
|
write(x1, " ", y1, " M ", x2, " ", y2, " L");
|
||||||
|
return;
|
||||||
|
} else if (s instanceof Rectangle2D) {
|
||||||
|
Rectangle2D r = (Rectangle2D) s;
|
||||||
|
double x = r.getX();
|
||||||
|
double y = r.getY();
|
||||||
|
double width = r.getWidth();
|
||||||
|
double height = r.getHeight();
|
||||||
|
write(x, " ", y, " ", width, " ", height, " rect Z");
|
||||||
|
return;
|
||||||
|
} else if (s instanceof Ellipse2D) {
|
||||||
|
Ellipse2D e = (Ellipse2D) s;
|
||||||
|
double x = e.getX() + e.getWidth()/2.0;
|
||||||
|
double y = e.getY() + e.getHeight()/2.0;
|
||||||
|
double rx = e.getWidth()/2.0;
|
||||||
|
double ry = e.getHeight()/2.0;
|
||||||
|
write(x, " ", y, " ", rx, " ", ry, " ", 360.0, " ", 0.0,
|
||||||
|
" ellipse Z");
|
||||||
|
return;
|
||||||
|
} else if (s instanceof Arc2D) {
|
||||||
|
Arc2D e = (Arc2D) s;
|
||||||
|
double x = (e.getX() + e.getWidth()/2.0);
|
||||||
|
double y = (e.getY() + e.getHeight()/2.0);
|
||||||
|
double rx = e.getWidth()/2.0;
|
||||||
|
double ry = e.getHeight()/2.0;
|
||||||
|
double startAngle = -e.getAngleStart();
|
||||||
|
double endAngle = -(e.getAngleStart() + e.getAngleExtent());
|
||||||
|
write(x, " ", y, " ", rx, " ", ry, " ", startAngle, " ", endAngle,
|
||||||
|
" ellipse");
|
||||||
|
if (e.getArcType() == Arc2D.CHORD) {
|
||||||
|
write(" Z");
|
||||||
|
} else if (e.getArcType() == Arc2D.PIE) {
|
||||||
|
write(" ", x, " ", y, " L Z");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
PathIterator segments = s.getPathIterator(null);
|
||||||
|
double[] coordsCur = new double[6];
|
||||||
|
double[] pointPrev = new double[2];
|
||||||
|
for (int i = 0; !segments.isDone(); i++, segments.next()) {
|
||||||
|
if (i > 0) {
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
int segmentType = segments.currentSegment(coordsCur);
|
||||||
|
switch (segmentType) {
|
||||||
|
case PathIterator.SEG_MOVETO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " M");
|
||||||
|
pointPrev[0] = coordsCur[0];
|
||||||
|
pointPrev[1] = coordsCur[1];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_LINETO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " L");
|
||||||
|
pointPrev[0] = coordsCur[0];
|
||||||
|
pointPrev[1] = coordsCur[1];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CUBICTO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " ",
|
||||||
|
coordsCur[2], " ", coordsCur[3], " ",
|
||||||
|
coordsCur[4], " ", coordsCur[5], " C");
|
||||||
|
pointPrev[0] = coordsCur[4];
|
||||||
|
pointPrev[1] = coordsCur[5];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_QUADTO:
|
||||||
|
double x1 = pointPrev[0] + 2.0/3.0*(coordsCur[0] - pointPrev[0]);
|
||||||
|
double y1 = pointPrev[1] + 2.0/3.0*(coordsCur[1] - pointPrev[1]);
|
||||||
|
double x2 = coordsCur[0] + 1.0/3.0*(coordsCur[2] - coordsCur[0]);
|
||||||
|
double y2 = coordsCur[1] + 1.0/3.0*(coordsCur[3] - coordsCur[1]);
|
||||||
|
double x3 = coordsCur[2];
|
||||||
|
double y3 = coordsCur[3];
|
||||||
|
write(x1, " ", y1, " ", x2, " ", y2, " ", x3, " ", y3,
|
||||||
|
" C");
|
||||||
|
pointPrev[0] = x3;
|
||||||
|
pointPrev[1] = y3;
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CLOSE:
|
||||||
|
write("Z");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unknown path operation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getEps(BufferedImage bufferedImg) {
|
||||||
|
int width = bufferedImg.getWidth();
|
||||||
|
int height = bufferedImg.getHeight();
|
||||||
|
int bands = bufferedImg.getSampleModel().getNumBands();
|
||||||
|
StringBuffer str = new StringBuffer(width*height*bands*2);
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
int pixel = bufferedImg.getRGB(x, y) & 0xffffff;
|
||||||
|
if (bands >= 3) {
|
||||||
|
String hex = String.format("%06x", pixel);
|
||||||
|
str.append(hex);
|
||||||
|
} else if (bands == 1) {
|
||||||
|
str.append(String.format("%02x", pixel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str.append("\n");
|
||||||
|
}
|
||||||
|
return str.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFooter() {
|
||||||
|
return "grestore % Restore state\n%%EOF\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getBytes() {
|
||||||
|
try {
|
||||||
|
return toString().getBytes("ISO-8859-1");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
return super.getBytes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
125
de/erichseifert/vectorgraphics2d/GraphicsUtils.java
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.GraphicsConfiguration;
|
||||||
|
import java.awt.GraphicsDevice;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
|
import java.awt.HeadlessException;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Transparency;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.ColorModel;
|
||||||
|
import java.awt.image.PixelGrabber;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class that contains utility functions for working with graphics.
|
||||||
|
* For example, this includes font handling.
|
||||||
|
*/
|
||||||
|
public abstract class GraphicsUtils {
|
||||||
|
/**
|
||||||
|
* Default constructor that prevents creation of class.
|
||||||
|
*/
|
||||||
|
protected GraphicsUtils() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns <code>true</code> if the specified image
|
||||||
|
* has transparent pixels.
|
||||||
|
* Taken from http://www.exampledepot.com/egs/java.awt.image/HasAlpha.html
|
||||||
|
* @param image
|
||||||
|
* @return <code>true</code> if the specified image has transparent pixels,
|
||||||
|
* <code>false</code> otherwise
|
||||||
|
*/
|
||||||
|
public static boolean hasAlpha(Image image) {
|
||||||
|
// If buffered image, the color model is readily available
|
||||||
|
if (image instanceof BufferedImage) {
|
||||||
|
BufferedImage bimage = (BufferedImage) image;
|
||||||
|
return bimage.getColorModel().hasAlpha();
|
||||||
|
}
|
||||||
|
// Use a pixel grabber to retrieve the image's color model;
|
||||||
|
// grabbing a single pixel is usually sufficient
|
||||||
|
PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
|
||||||
|
try {
|
||||||
|
pg.grabPixels();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
// Get the image's color model
|
||||||
|
ColorModel cm = pg.getColorModel();
|
||||||
|
return cm.hasAlpha();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns a buffered image with the contents of an image.
|
||||||
|
* Taken from http://www.exampledepot.com/egs/java.awt.image/Image2Buf.html
|
||||||
|
* @param image Image ot be converted
|
||||||
|
* @return a buffered image with the contents of the specified image
|
||||||
|
*/
|
||||||
|
public static BufferedImage toBufferedImage(Image image) {
|
||||||
|
if (image instanceof BufferedImage) {
|
||||||
|
return (BufferedImage) image;
|
||||||
|
}
|
||||||
|
// This code ensures that all the pixels in the image are loaded
|
||||||
|
image = new ImageIcon(image).getImage();
|
||||||
|
// Determine if the image has transparent pixels
|
||||||
|
boolean hasAlpha = hasAlpha(image);
|
||||||
|
// Create a buffered image with a format that's compatible with the
|
||||||
|
// screen
|
||||||
|
BufferedImage bimage = null;
|
||||||
|
GraphicsEnvironment ge = GraphicsEnvironment
|
||||||
|
.getLocalGraphicsEnvironment();
|
||||||
|
try {
|
||||||
|
// Determine the type of transparency of the new buffered image
|
||||||
|
int transparency = Transparency.OPAQUE;
|
||||||
|
if (hasAlpha) {
|
||||||
|
transparency = Transparency.BITMASK;
|
||||||
|
}
|
||||||
|
// Create the buffered image
|
||||||
|
GraphicsDevice gs = ge.getDefaultScreenDevice();
|
||||||
|
GraphicsConfiguration gc = gs.getDefaultConfiguration();
|
||||||
|
bimage = gc.createCompatibleImage(
|
||||||
|
image.getWidth(null), image.getHeight(null), transparency);
|
||||||
|
} catch (HeadlessException e) {
|
||||||
|
// The system does not have a screen
|
||||||
|
bimage = null;
|
||||||
|
}
|
||||||
|
if (bimage == null) {
|
||||||
|
// Create a buffered image using the default color model
|
||||||
|
int type = BufferedImage.TYPE_INT_RGB;
|
||||||
|
if (hasAlpha) {
|
||||||
|
type = BufferedImage.TYPE_INT_ARGB;
|
||||||
|
}
|
||||||
|
bimage = new BufferedImage(
|
||||||
|
image.getWidth(null), image.getHeight(null), type);
|
||||||
|
}
|
||||||
|
// Copy image to buffered image
|
||||||
|
Graphics g = bimage.createGraphics();
|
||||||
|
// Paint the image onto the buffered image
|
||||||
|
g.drawImage(image, 0, 0, null);
|
||||||
|
g.dispose();
|
||||||
|
return bimage;
|
||||||
|
}
|
||||||
|
}
|
637
de/erichseifert/vectorgraphics2d/PDFGraphics2D.java
Normal file
@ -0,0 +1,637 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.Stroke;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Line2D;
|
||||||
|
import java.awt.geom.PathIterator;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import rene.zirkel.objects.AngleObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>Graphics2D</code> implementation that saves all operations to a string
|
||||||
|
* in the <i>Portable Document Format</i> (PDF).
|
||||||
|
*/
|
||||||
|
public class PDFGraphics2D extends VectorGraphics2D {
|
||||||
|
/** Prefix string for PDF font resource ids. */
|
||||||
|
protected static final String FONT_RESOURCE_PREFIX = "F";
|
||||||
|
/** Prefix string for PDF image resource ids. */
|
||||||
|
protected static final String IMAGE_RESOURCE_PREFIX = "Im";
|
||||||
|
/** Prefix string for PDF transparency resource ids. */
|
||||||
|
protected static final String TRANSPARENCY_RESOURCE_PREFIX = "T";
|
||||||
|
|
||||||
|
/** Constant to convert values from millimeters to PostScript®/PDF units (1/72th inch). */
|
||||||
|
protected static final double MM_IN_UNITS = 72.0 / 25.4;
|
||||||
|
|
||||||
|
/** Mapping of stroke endcap values from Java to PDF. */
|
||||||
|
private static final Map<Integer, Integer> STROKE_ENDCAPS = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE },
|
||||||
|
new Integer[] { 0, 1, 2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Mapping of line join values for path drawing from Java to PDF. */
|
||||||
|
private static final Map<Integer, Integer> STROKE_LINEJOIN = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL },
|
||||||
|
new Integer[] { 0, 1, 2 }
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Id of the current PDF object. */
|
||||||
|
private int curObjId;
|
||||||
|
/** Mapping from objects to file positions. */
|
||||||
|
private final Map<Integer, Integer> objPositions;
|
||||||
|
/** Mapping from transparency levels to transparency resource ids. */
|
||||||
|
private final Map<Double, String> transpResources;
|
||||||
|
/** Mapping from image data to image resource ids. */
|
||||||
|
private final Map<BufferedImage, String> imageResources;
|
||||||
|
/** Mapping from font objects to font resource ids. */
|
||||||
|
private final Map<Font, String> fontResources;
|
||||||
|
/** File position of the actual content. */
|
||||||
|
private int contentStart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor that initializes a new <code>PDFGraphics2D</code> instance.
|
||||||
|
* The document dimension must be specified as parameters.
|
||||||
|
*/
|
||||||
|
public PDFGraphics2D(double x, double y, double width, double height) {
|
||||||
|
super(x, y, width, height);
|
||||||
|
curObjId = 1;
|
||||||
|
objPositions = new TreeMap<Integer, Integer>();
|
||||||
|
transpResources = new TreeMap<Double, String>();
|
||||||
|
imageResources = new LinkedHashMap<BufferedImage, String>();
|
||||||
|
fontResources = new LinkedHashMap<Font, String>();
|
||||||
|
writeHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeString(String str, double x, double y) {
|
||||||
|
// Escape string
|
||||||
|
str = str.replaceAll("\\\\", "\\\\\\\\")
|
||||||
|
.replaceAll("\t", "\\\\t").replaceAll("\b", "\\\\b").replaceAll("\f", "\\\\f")
|
||||||
|
.replaceAll("\\(", "\\\\(").replaceAll("\\)", "\\\\)");
|
||||||
|
|
||||||
|
x+=getTransform().getTranslateX();
|
||||||
|
y+=getTransform().getTranslateY();
|
||||||
|
|
||||||
|
float fontSize = getFont().getSize2D();
|
||||||
|
|
||||||
|
|
||||||
|
//float leading = getFont().getLineMetrics("", getFontRenderContext()).getLeading();
|
||||||
|
|
||||||
|
// Start text and save current graphics state
|
||||||
|
writeln("q BT");
|
||||||
|
|
||||||
|
String fontResourceId = getFontResource(getFont());
|
||||||
|
writeln("/", fontResourceId, " ", fontSize, " Tf");
|
||||||
|
// Set leading
|
||||||
|
//writeln(fontSize + leading, " TL");
|
||||||
|
|
||||||
|
// Undo swapping of y axis for text
|
||||||
|
writeln("1 0 0 -1 ", x, " ", y, " cm");
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Extract lines
|
||||||
|
String[] lines = str.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
||||||
|
// Paint lines
|
||||||
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
writeln("(", lines[i], ") ", (i == 0) ? "Tj" : "'");
|
||||||
|
}*/
|
||||||
|
|
||||||
|
str = str.replaceAll("[\r\n]", "");
|
||||||
|
writeln("(", str, ") Tj");
|
||||||
|
|
||||||
|
// End text and restore previous graphics state
|
||||||
|
writeln("ET Q");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStroke(Stroke s) {
|
||||||
|
BasicStroke bsPrev;
|
||||||
|
if (getStroke() instanceof BasicStroke) {
|
||||||
|
bsPrev = (BasicStroke) getStroke();
|
||||||
|
} else {
|
||||||
|
bsPrev = new BasicStroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.setStroke(s);
|
||||||
|
|
||||||
|
if (s instanceof BasicStroke) {
|
||||||
|
BasicStroke bs = (BasicStroke) s;
|
||||||
|
if (bs.getLineWidth() != bsPrev.getLineWidth()) {
|
||||||
|
writeln(bs.getLineWidth(), " w");
|
||||||
|
}
|
||||||
|
if (bs.getLineJoin() != bsPrev.getLineJoin()) {
|
||||||
|
writeln(STROKE_LINEJOIN.get(bs.getLineJoin()), " j");
|
||||||
|
}
|
||||||
|
if (bs.getEndCap() != bsPrev.getEndCap()) {
|
||||||
|
writeln(STROKE_ENDCAPS.get(bs.getEndCap()), " J");
|
||||||
|
}
|
||||||
|
if ((!Arrays.equals(bs.getDashArray(), bsPrev.getDashArray()))
|
||||||
|
|| (bs.getDashPhase() != bsPrev.getDashPhase())) {
|
||||||
|
writeln("[", DataUtils.join(" ", bs.getDashArray()), "] ",
|
||||||
|
bs.getDashPhase(), " d");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeImage(Image img, int imgWidth, int imgHeight,
|
||||||
|
double x, double y, double width, double height) {
|
||||||
|
BufferedImage bufferedImg = GraphicsUtils.toBufferedImage(img);
|
||||||
|
String imageResourceId = getImageResource(bufferedImg);
|
||||||
|
// Save graphics state
|
||||||
|
write("q ");
|
||||||
|
// Take current transformations into account
|
||||||
|
AffineTransform txCurrent = getTransform();
|
||||||
|
if (!txCurrent.isIdentity()) {
|
||||||
|
double[] matrix = new double[6];
|
||||||
|
txCurrent.getMatrix(matrix);
|
||||||
|
write(DataUtils.join(" ", matrix), " cm ");
|
||||||
|
}
|
||||||
|
// Move image to correct position and scale it to (width, height)
|
||||||
|
write(width, " 0 0 ", height, " ", x, " ", y, " cm ");
|
||||||
|
// Swap y axis
|
||||||
|
write("1 0 0 -1 0 1 cm ");
|
||||||
|
// Draw image
|
||||||
|
write("/", imageResourceId, " Do ");
|
||||||
|
// Restore old graphics state
|
||||||
|
writeln("Q");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color c) {
|
||||||
|
Color color = getColor();
|
||||||
|
if (c != null) {
|
||||||
|
super.setColor(c);
|
||||||
|
if (color.getAlpha() != c.getAlpha()) {
|
||||||
|
// Add a new graphics state to resources
|
||||||
|
double a = c.getAlpha()/255.0;
|
||||||
|
|
||||||
|
String transpResourceId = getTransparencyResource(a);
|
||||||
|
writeln("/", transpResourceId, " gs");
|
||||||
|
}
|
||||||
|
if (color.getRed() != c.getRed() || color.getGreen() != c.getGreen()
|
||||||
|
|| color.getBlue() != c.getBlue()) {
|
||||||
|
double r = c.getRed()/255.0;
|
||||||
|
double g = c.getGreen()/255.0;
|
||||||
|
double b = c.getBlue()/255.0;
|
||||||
|
write(r, " ", g, " ", b, " rg ");
|
||||||
|
writeln(r, " ", g, " ", b, " RG");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClip(Shape clip) {
|
||||||
|
if (getClip() != null) {
|
||||||
|
writeln("Q");
|
||||||
|
}
|
||||||
|
super.setClip(clip);
|
||||||
|
if (getClip() != null) {
|
||||||
|
writeln("q");
|
||||||
|
writeShape(getClip());
|
||||||
|
writeln(" W n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Correct transformations
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
protected void setAffineTransform(AffineTransform tx) {
|
||||||
|
if (getTransform().equals(tx)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Undo previous transforms
|
||||||
|
if (isTransformed()) {
|
||||||
|
writeln("Q");
|
||||||
|
}
|
||||||
|
// Set new transform
|
||||||
|
super.setAffineTransform(tx);
|
||||||
|
// Write transform to document
|
||||||
|
if (isTransformed()) {
|
||||||
|
writeln("q");
|
||||||
|
double[] matrix = new double[6];
|
||||||
|
getTransform().getMatrix(matrix);
|
||||||
|
writeln(DataUtils.join(" ", matrix), " cm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeHeader() {
|
||||||
|
Rectangle2D bounds = getBounds();
|
||||||
|
int x = (int) Math.floor(bounds.getX() * MM_IN_UNITS);
|
||||||
|
int y = (int) Math.floor(bounds.getY() * MM_IN_UNITS);
|
||||||
|
int w = (int) Math.ceil(bounds.getWidth() * MM_IN_UNITS);
|
||||||
|
int h = (int) Math.ceil(bounds.getHeight() * MM_IN_UNITS);
|
||||||
|
|
||||||
|
writeln("%PDF-1.4");
|
||||||
|
// Object 1
|
||||||
|
writeObj(
|
||||||
|
"Type", "/Catalog",
|
||||||
|
"Pages", "2 0 R"
|
||||||
|
);
|
||||||
|
// Object 2
|
||||||
|
writeObj(
|
||||||
|
"Type", "/Pages",
|
||||||
|
"Kids", "[3 0 R]",
|
||||||
|
"Count", "1"
|
||||||
|
);
|
||||||
|
// Object 3
|
||||||
|
writeObj(
|
||||||
|
"Type", "/Page",
|
||||||
|
"Parent", "2 0 R",
|
||||||
|
"MediaBox", String.format("[%d %d %d %d]", x, y, w, h),
|
||||||
|
"Contents", "4 0 R",
|
||||||
|
"Resources", "6 0 R"
|
||||||
|
);
|
||||||
|
// Object 5
|
||||||
|
writeln(nextObjId(size()), " 0 obj");
|
||||||
|
writeDict("Length", "5 0 R");
|
||||||
|
writeln("stream");
|
||||||
|
contentStart = size();
|
||||||
|
writeln("q");
|
||||||
|
// Adjust page size and page origin
|
||||||
|
writeln(MM_IN_UNITS, " 0 0 ", -MM_IN_UNITS, " 0 ", h, " cm");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a PDF dictionary from the specified collection of objects.
|
||||||
|
* The passed objects are converted to strings. Every object with odd
|
||||||
|
* position is used as key, every object with even position is used
|
||||||
|
* as value.
|
||||||
|
* @param strs Objects to be written to dictionary
|
||||||
|
*/
|
||||||
|
protected void writeDict(Object... strs) {
|
||||||
|
writeln("<<");
|
||||||
|
for (int i = 0; i < strs.length; i += 2) {
|
||||||
|
writeln("/", strs[i], " ", strs[i + 1]);
|
||||||
|
}
|
||||||
|
writeln(">>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a collection of elements to the document stream as PDF object.
|
||||||
|
* The passed objects are converted to strings.
|
||||||
|
* @param strs Objects to be written to the document stream.
|
||||||
|
* @return Id of the PDF object that was written.
|
||||||
|
*/
|
||||||
|
protected int writeObj(Object... strs) {
|
||||||
|
int objId = nextObjId(size());
|
||||||
|
writeln(objId, " 0 obj");
|
||||||
|
writeDict(strs);
|
||||||
|
writeln("endobj");
|
||||||
|
return objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next PDF object id without incrementing.
|
||||||
|
* @return Next PDF object id.
|
||||||
|
*/
|
||||||
|
protected int peekObjId() {
|
||||||
|
return curObjId + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new PDF object id with every call.
|
||||||
|
* @param position File position of the object.
|
||||||
|
* @return A new PDF object id.
|
||||||
|
*/
|
||||||
|
private int nextObjId(int position) {
|
||||||
|
objPositions.put(curObjId, position);
|
||||||
|
return curObjId++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource for the specified transparency level.
|
||||||
|
* @param a Transparency level.
|
||||||
|
* @return A new PDF object id.
|
||||||
|
*/
|
||||||
|
protected String getTransparencyResource(double a) {
|
||||||
|
String name = transpResources.get(a);
|
||||||
|
if (name == null) {
|
||||||
|
name = String.format("%s%d", TRANSPARENCY_RESOURCE_PREFIX,
|
||||||
|
transpResources.size() + 1);
|
||||||
|
transpResources.put(a, name);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource for the specified image data.
|
||||||
|
* @param bufferedImg Image object with data.
|
||||||
|
* @return A new PDF object id.
|
||||||
|
*/
|
||||||
|
protected String getImageResource(BufferedImage bufferedImg) {
|
||||||
|
String name = imageResources.get(bufferedImg);
|
||||||
|
if (name == null) {
|
||||||
|
name = String.format("%s%d", IMAGE_RESOURCE_PREFIX,
|
||||||
|
imageResources.size() + 1);
|
||||||
|
imageResources.put(bufferedImg, name);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resource describing the specified font.
|
||||||
|
* @param font Font to be described.
|
||||||
|
* @return A new PDF object id.
|
||||||
|
*/
|
||||||
|
protected String getFontResource(Font font) {
|
||||||
|
String name = fontResources.get(font);
|
||||||
|
if (name == null) {
|
||||||
|
name = String.format("%s%d", FONT_RESOURCE_PREFIX,
|
||||||
|
fontResources.size() + 1);
|
||||||
|
fontResources.put(font, name);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing a tag closing fragment for drawing
|
||||||
|
* operations.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeClosingDraw(Shape s) {
|
||||||
|
writeln(" S");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing a tag closing fragment for filling
|
||||||
|
* operations.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeClosingFill(Shape s) {
|
||||||
|
writeln(" f");
|
||||||
|
if (!(getPaint() instanceof Color)) {
|
||||||
|
super.writeClosingFill(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing an arbitrary shape to.
|
||||||
|
* It tries to translate Java2D shapes to the corresponding PDF shape
|
||||||
|
* commands.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void writeShape(Shape s) {
|
||||||
|
// TODO Correct transformations
|
||||||
|
|
||||||
|
// if (s instanceof Line2D) {
|
||||||
|
// Line2D l = (Line2D) s;
|
||||||
|
// double x1 = l.getX1();
|
||||||
|
// double y1 = l.getY1();
|
||||||
|
// double x2 = l.getX2();
|
||||||
|
// double y2 = l.getY2();
|
||||||
|
// write(x1, " ", y1, " m ", x2, " ", y2, " l");
|
||||||
|
// } else if (s instanceof Rectangle2D) {
|
||||||
|
// Rectangle2D r = (Rectangle2D) s;
|
||||||
|
// double x = r.getX();
|
||||||
|
// double y = r.getY();
|
||||||
|
// double width = r.getWidth();
|
||||||
|
// double height = r.getHeight();
|
||||||
|
// write(x, " ", y, " ", width, " ", height, " re");
|
||||||
|
// } else
|
||||||
|
{
|
||||||
|
|
||||||
|
s = getTransform().createTransformedShape(s);
|
||||||
|
PathIterator segments = s.getPathIterator(null);
|
||||||
|
double[] coordsCur = new double[6];
|
||||||
|
double[] pointPrev = new double[2];
|
||||||
|
for (int i = 0; !segments.isDone(); i++, segments.next()) {
|
||||||
|
if (i > 0) {
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
int segmentType = segments.currentSegment(coordsCur);
|
||||||
|
switch (segmentType) {
|
||||||
|
case PathIterator.SEG_MOVETO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " m");
|
||||||
|
pointPrev[0] = coordsCur[0];
|
||||||
|
pointPrev[1] = coordsCur[1];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_LINETO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " l");
|
||||||
|
pointPrev[0] = coordsCur[0];
|
||||||
|
pointPrev[1] = coordsCur[1];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CUBICTO:
|
||||||
|
write(coordsCur[0], " ", coordsCur[1], " ",
|
||||||
|
coordsCur[2], " ", coordsCur[3], " ",
|
||||||
|
coordsCur[4], " ", coordsCur[5], " c");
|
||||||
|
pointPrev[0] = coordsCur[4];
|
||||||
|
pointPrev[1] = coordsCur[5];
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_QUADTO:
|
||||||
|
double x1 = pointPrev[0] + 2.0/3.0*(coordsCur[0] - pointPrev[0]);
|
||||||
|
double y1 = pointPrev[1] + 2.0/3.0*(coordsCur[1] - pointPrev[1]);
|
||||||
|
double x2 = coordsCur[0] + 1.0/3.0*(coordsCur[2] - coordsCur[0]);
|
||||||
|
double y2 = coordsCur[1] + 1.0/3.0*(coordsCur[3] - coordsCur[1]);
|
||||||
|
double x3 = coordsCur[2];
|
||||||
|
double y3 = coordsCur[3];
|
||||||
|
write(x1, " ", y1, " ", x2, " ", y2, " ",
|
||||||
|
x3, " ", y3, " c");
|
||||||
|
pointPrev[0] = x3;
|
||||||
|
pointPrev[1] = y3;
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CLOSE:
|
||||||
|
write("h");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unknown path operation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string which represents the data of the specified image.
|
||||||
|
* @param bufferedImg Image to convert.
|
||||||
|
* @return String with image data.
|
||||||
|
*/
|
||||||
|
private String getPdf(BufferedImage bufferedImg) {
|
||||||
|
int width = bufferedImg.getWidth();
|
||||||
|
int height = bufferedImg.getHeight();
|
||||||
|
int bands = bufferedImg.getSampleModel().getNumBands();
|
||||||
|
StringBuffer str = new StringBuffer(width*height*bands*2);
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
int pixel = bufferedImg.getRGB(x, y) & 0xffffff;
|
||||||
|
if (bands >= 3) {
|
||||||
|
String hex = String.format("%06x", pixel);
|
||||||
|
str.append(hex);
|
||||||
|
} else if (bands == 1) {
|
||||||
|
str.append(String.format("%02x", pixel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str.append('\n');
|
||||||
|
}
|
||||||
|
return str.append('>').toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFooter() {
|
||||||
|
StringBuffer footer = new StringBuffer();
|
||||||
|
// TODO Correct transformations
|
||||||
|
/*if (isTransformed()) {
|
||||||
|
footer.append("Q\n");
|
||||||
|
}*/
|
||||||
|
if (getClip() != null) {
|
||||||
|
footer.append("Q\n");
|
||||||
|
}
|
||||||
|
footer.append("Q");
|
||||||
|
int contentEnd = size() + footer.length();
|
||||||
|
footer.append('\n');
|
||||||
|
footer.append("endstream\n");
|
||||||
|
footer.append("endobj\n");
|
||||||
|
|
||||||
|
int lenObjId = nextObjId(size() + footer.length());
|
||||||
|
footer.append(lenObjId).append(" 0 obj\n");
|
||||||
|
footer.append(contentEnd - contentStart).append('\n');
|
||||||
|
footer.append("endobj\n");
|
||||||
|
|
||||||
|
int resourcesObjId = nextObjId(size() + footer.length());
|
||||||
|
footer.append(resourcesObjId).append(" 0 obj\n");
|
||||||
|
footer.append("<<\n");
|
||||||
|
footer.append(" /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]\n");
|
||||||
|
|
||||||
|
|
||||||
|
// Add resources for fonts
|
||||||
|
if (!fontResources.isEmpty()) {
|
||||||
|
footer.append(" /Font <<\n");
|
||||||
|
for (Map.Entry<Font, String> entry : fontResources.entrySet()) {
|
||||||
|
Font font = entry.getKey();
|
||||||
|
String resourceId = entry.getValue();
|
||||||
|
footer.append(" /").append(resourceId)
|
||||||
|
.append(" << /Type /Font")
|
||||||
|
.append(" /Subtype /").append("TrueType")
|
||||||
|
.append(" /BaseFont /").append(font.getPSName())
|
||||||
|
.append(" /Encoding /").append("WinAnsiEncoding")
|
||||||
|
.append(" >>\n");
|
||||||
|
}
|
||||||
|
footer.append(" >>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add resources for images
|
||||||
|
if (!imageResources.isEmpty()) {
|
||||||
|
footer.append(" /XObject <<\n");
|
||||||
|
|
||||||
|
int objIdOffset = 0;
|
||||||
|
for (Map.Entry<BufferedImage, String> entry :
|
||||||
|
imageResources.entrySet()) {
|
||||||
|
String resourceId = entry.getValue();
|
||||||
|
footer.append(" /").append(resourceId).append(' ')
|
||||||
|
.append(curObjId + objIdOffset).append(" 0 R\n");
|
||||||
|
objIdOffset++;
|
||||||
|
}
|
||||||
|
footer.append(" >>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add resources for transparency levels
|
||||||
|
if (!transpResources.isEmpty()) {
|
||||||
|
footer.append(" /ExtGState <<\n");
|
||||||
|
for (Map.Entry<Double, String> entry : transpResources.entrySet()) {
|
||||||
|
Double alpha = entry.getKey();
|
||||||
|
String resourceId = entry.getValue();
|
||||||
|
footer.append(" /").append(resourceId)
|
||||||
|
.append(" << /Type /ExtGState")
|
||||||
|
.append(" /ca ").append(alpha).append(" /CA ").append(alpha)
|
||||||
|
.append(" >>\n");
|
||||||
|
}
|
||||||
|
footer.append(" >>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
footer.append(">>\n");
|
||||||
|
footer.append("endobj\n");
|
||||||
|
|
||||||
|
// Add data of images
|
||||||
|
for (BufferedImage image : imageResources.keySet()) {
|
||||||
|
int imageObjId = nextObjId(size() + footer.length());
|
||||||
|
footer.append(imageObjId).append(" 0 obj\n");
|
||||||
|
footer.append("<<\n");
|
||||||
|
String imageData = getPdf(image);
|
||||||
|
footer.append("/Type /XObject\n")
|
||||||
|
.append("/Subtype /Image\n")
|
||||||
|
.append("/Width ").append(image.getWidth()).append('\n')
|
||||||
|
.append("/Height ").append(image.getHeight()).append('\n')
|
||||||
|
.append("/ColorSpace /DeviceRGB\n")
|
||||||
|
.append("/BitsPerComponent 8\n")
|
||||||
|
.append("/Length ").append(imageData.length()).append('\n')
|
||||||
|
.append("/Filter /ASCIIHexDecode\n")
|
||||||
|
.append(">>\n")
|
||||||
|
.append("stream\n")
|
||||||
|
.append(imageData)
|
||||||
|
.append("\nendstream\n")
|
||||||
|
.append("endobj\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int objs = objPositions.size() + 1;
|
||||||
|
|
||||||
|
int xrefPos = size() + footer.length();
|
||||||
|
footer.append("xref\n");
|
||||||
|
footer.append("0 ").append(objs).append('\n');
|
||||||
|
// lines of xref entries must must be exactly 20 bytes long
|
||||||
|
// (including line break) and thus end with <SPACE NEWLINE>
|
||||||
|
footer.append(String.format("%010d %05d", 0, 65535)).append(" f \n");
|
||||||
|
for (int pos : objPositions.values()) {
|
||||||
|
footer.append(String.format("%010d %05d", pos, 0)).append(" n \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
footer.append("trailer\n");
|
||||||
|
footer.append("<<\n");
|
||||||
|
footer.append("/Size ").append(objs).append('\n');
|
||||||
|
footer.append("/Root 1 0 R\n");
|
||||||
|
footer.append(">>\n");
|
||||||
|
footer.append("startxref\n");
|
||||||
|
footer.append(xrefPos).append('\n');
|
||||||
|
|
||||||
|
footer.append("%%EOF\n");
|
||||||
|
|
||||||
|
return footer.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String doc = super.toString();
|
||||||
|
//doc = doc.replaceAll("q\n[0-9]+\\.?[0-9]* [0-9]+\\.?[0-9]* [0-9]+\\.?[0-9]* [0-9]+\\.?[0-9]* [0-9]+\\.?[0-9]* [0-9]+\\.?[0-9]* cm\nQ\n", "");
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getBytes() {
|
||||||
|
try {
|
||||||
|
return toString().getBytes("ISO-8859-1");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
return super.getBytes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
371
de/erichseifert/vectorgraphics2d/SVGGraphics2D.java
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Line2D;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
|
import java.awt.geom.PathIterator;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.xml.bind.DatatypeConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <code>Graphics2D</code> implementation that saves all operations to a string
|
||||||
|
* in the <i>Scaled Vector Graphics</i> (SVG) format.
|
||||||
|
*/
|
||||||
|
public class SVGGraphics2D extends VectorGraphics2D {
|
||||||
|
/** Mapping of stroke endcap values from Java to SVG. */
|
||||||
|
private static final Map<Integer, String> STROKE_ENDCAPS = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE },
|
||||||
|
new String[] { "butt", "round", "square" }
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Mapping of line join values for path drawing from Java to SVG. */
|
||||||
|
private static final Map<Integer, String> STROKE_LINEJOIN = DataUtils.map(
|
||||||
|
new Integer[] { BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND, BasicStroke.JOIN_BEVEL },
|
||||||
|
new String[] { "miter", "round", "bevel" }
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Prefix string for ids of clipping paths. */
|
||||||
|
private static final String CLIP_PATH_ID = "clip";
|
||||||
|
/** Number of the current clipping path. */
|
||||||
|
private long clipCounter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor that initializes a new <code>SVGGraphics2D</code> instance.
|
||||||
|
* The document dimension must be specified as parameters.
|
||||||
|
*/
|
||||||
|
public SVGGraphics2D(double x, double y, double width, double height) {
|
||||||
|
super(x, y, width, height);
|
||||||
|
writeHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeString(String str, double x, double y) {
|
||||||
|
// Escape string
|
||||||
|
str = str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
||||||
|
|
||||||
|
float fontSize = getFont().getSize2D();
|
||||||
|
//float leading = getFont().getLineMetrics("", getFontRenderContext()).getLeading();
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Extract lines
|
||||||
|
String[] lines = str.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
||||||
|
|
||||||
|
// Output lines
|
||||||
|
writeln("<text style=\"font:", fontSize, "px ", getFont().getFamily(), "\">");
|
||||||
|
for (int i = 0; i < lines.length; i++) {
|
||||||
|
String line = lines[i];
|
||||||
|
writeln(" <tspan x=\"", x, "\" y=\"", y + i*fontSize + ((i>0) ? leading : 0f), "\">", line, "</tspan>");
|
||||||
|
}
|
||||||
|
writeln("</text>");
|
||||||
|
*/
|
||||||
|
|
||||||
|
str = str.replaceAll("[\r\n]", "");
|
||||||
|
writeln("<text x=\"", x, "\" y=\"", y, "\" style=\"font:",
|
||||||
|
fontSize, "px ", getFont().getFamily(), "\">", str, "</text>");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeImage(Image img, int imgWidth, int imgHeight, double x,
|
||||||
|
double y, double width, double height) {
|
||||||
|
BufferedImage bufferedImg = GraphicsUtils.toBufferedImage(img);
|
||||||
|
String imgData = getSvg(bufferedImg);
|
||||||
|
write("<image x=\"" , x, "\" y=\"" , y, "\" ",
|
||||||
|
"width=\"" , width, "\" height=\"" , height, "\" ",
|
||||||
|
"xlink:href=\"", imgData, "\" ",
|
||||||
|
"/>");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D s = new Path2D.Double(Path2D.WIND_NON_ZERO, xPoints.length);
|
||||||
|
write("<polygon points=\"");
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
s.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
s.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
write(xPoints[i], ",", yPoints[i]);
|
||||||
|
}
|
||||||
|
write("\" ");
|
||||||
|
s.closePath();
|
||||||
|
writeClosingDraw(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D s = new Path2D.Double(Path2D.WIND_NON_ZERO, xPoints.length);
|
||||||
|
write("<polyline points=\"");
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
s.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
s.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
write(xPoints[i], ",", yPoints[i]);
|
||||||
|
}
|
||||||
|
write("\" ");
|
||||||
|
writeClosingDraw(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D s = new Path2D.Double(Path2D.WIND_NON_ZERO, xPoints.length);
|
||||||
|
write("<polygon points=\"");
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
s.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
s.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
write(xPoints[i], ",", yPoints[i]);
|
||||||
|
}
|
||||||
|
write("\" ");
|
||||||
|
s.closePath();
|
||||||
|
writeClosingFill(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClip(Shape clip) {
|
||||||
|
super.setClip(clip);
|
||||||
|
if (getClip() != null) {
|
||||||
|
writeln("<clipPath id=\"", CLIP_PATH_ID, ++clipCounter, "\">");
|
||||||
|
writeShape(getClip());
|
||||||
|
writeln("/>");
|
||||||
|
writeln("</clipPath>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setAffineTransform(AffineTransform tx) {
|
||||||
|
if (getTransform().equals(tx)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Close previous transformation group
|
||||||
|
if (isTransformed()) {
|
||||||
|
writeln("</g>");
|
||||||
|
}
|
||||||
|
// Set transformation matrix
|
||||||
|
super.setAffineTransform(tx);
|
||||||
|
// Begin new transformation group
|
||||||
|
if (isTransformed()) {
|
||||||
|
double[] matrix = new double[6];
|
||||||
|
getTransform().getMatrix(matrix);
|
||||||
|
write("<g transform=\"matrix(",
|
||||||
|
DataUtils.join(" ", matrix),") \">");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeHeader() {
|
||||||
|
Rectangle2D bounds = getBounds();
|
||||||
|
double x = bounds.getX();
|
||||||
|
double y = bounds.getY();
|
||||||
|
double w = bounds.getWidth();
|
||||||
|
double h = bounds.getHeight();
|
||||||
|
writeln("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||||
|
writeln("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" ",
|
||||||
|
"\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">");
|
||||||
|
writeln("<svg version=\"1.2\" xmlns=\"http://www.w3.org/2000/svg\" ",
|
||||||
|
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" ",
|
||||||
|
"x=\"", x, "mm\" y=\"", y, "mm\" ",
|
||||||
|
"width=\"", w, "mm\" height=\"", h, "mm\" " +
|
||||||
|
"viewBox=\"", x, " ", y, " ", w, " ", h, "\"",
|
||||||
|
">");
|
||||||
|
writeln("<style type=\"text/css\"><![CDATA[");
|
||||||
|
writeln("text { font:", getFont().getSize2D(), "px ",
|
||||||
|
getFont().getFamily(), "; }");
|
||||||
|
writeln("]]></style>");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeClosingDraw(Shape s) {
|
||||||
|
write("style=\"fill:none;stroke:", getSvg(getColor()));
|
||||||
|
if (getStroke() instanceof BasicStroke) {
|
||||||
|
BasicStroke stroke = (BasicStroke) getStroke();
|
||||||
|
if (stroke.getLineWidth() != 1f) {
|
||||||
|
write(";stroke-width:", stroke.getLineWidth());
|
||||||
|
}
|
||||||
|
if (stroke.getEndCap() != BasicStroke.CAP_BUTT) {
|
||||||
|
write(";stroke-linecap:", STROKE_ENDCAPS.get(stroke.getEndCap()));
|
||||||
|
}
|
||||||
|
if (stroke.getLineJoin() != BasicStroke.JOIN_MITER) {
|
||||||
|
write(";stroke-linejoin:",
|
||||||
|
STROKE_LINEJOIN.get(stroke.getLineJoin()));
|
||||||
|
}
|
||||||
|
//write(";stroke-miterlimit:", s.getMiterLimit());
|
||||||
|
if (stroke.getDashArray() != null && stroke.getDashArray().length > 0) {
|
||||||
|
write(";stroke-dasharray:",
|
||||||
|
DataUtils.join(",", stroke.getDashArray()));
|
||||||
|
write(";stroke-dashoffset:", stroke.getDashPhase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (getClip() != null) {
|
||||||
|
write("\" clip-path=\"url(#", CLIP_PATH_ID, clipCounter, ")");
|
||||||
|
}
|
||||||
|
writeln("\" />");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeClosingFill(Shape s) {
|
||||||
|
if (getPaint() instanceof Color) {
|
||||||
|
write("style=\"fill:", getSvg(getColor()), ";stroke:none");
|
||||||
|
if (getClip() != null) {
|
||||||
|
write("\" clip-path=\"url(#", CLIP_PATH_ID, clipCounter, ")");
|
||||||
|
}
|
||||||
|
writeln("\" />");
|
||||||
|
} else {
|
||||||
|
write("style=\"stroke:none\" />");
|
||||||
|
super.writeClosingFill(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeShape(Shape s) {
|
||||||
|
if (s instanceof Line2D) {
|
||||||
|
Line2D l = (Line2D) s;
|
||||||
|
double x1 = l.getX1();
|
||||||
|
double y1 = l.getY1();
|
||||||
|
double x2 = l.getX2();
|
||||||
|
double y2 = l.getY2();
|
||||||
|
write("<line x1=\"", x1, "\" y1=\"", y1,
|
||||||
|
"\" x2=\"", x2, "\" y2=\"", y2, "\" ");
|
||||||
|
} else if (s instanceof Rectangle2D) {
|
||||||
|
Rectangle2D r = (Rectangle2D) s;
|
||||||
|
double x = r.getX();
|
||||||
|
double y = r.getY();
|
||||||
|
double width = r.getWidth();
|
||||||
|
double height = r.getHeight();
|
||||||
|
write("<rect x=\"", x, "\" y=\"", y,
|
||||||
|
"\" width=\"", width, "\" height=\"", height, "\" ");
|
||||||
|
} else if (s instanceof RoundRectangle2D) {
|
||||||
|
RoundRectangle2D r = (RoundRectangle2D) s;
|
||||||
|
double x = r.getX();
|
||||||
|
double y = r.getY();
|
||||||
|
double width = r.getWidth();
|
||||||
|
double height = r.getHeight();
|
||||||
|
double arcWidth = r.getArcWidth();
|
||||||
|
double arcHeight = r.getArcHeight();
|
||||||
|
write("<rect x=\"", x, "\" y=\"", y,
|
||||||
|
"\" width=\"", width, "\" height=\"", height,
|
||||||
|
"\" rx=\"", arcWidth, "\" ry=\"", arcHeight, "\" ");
|
||||||
|
} else if (s instanceof Ellipse2D) {
|
||||||
|
Ellipse2D e = (Ellipse2D) s;
|
||||||
|
double x = e.getX();
|
||||||
|
double y = e.getY();
|
||||||
|
double rx = e.getWidth()/2.0;
|
||||||
|
double ry = e.getHeight()/2.0;
|
||||||
|
write("<ellipse cx=\"", x + rx, "\" cy=\"", y + ry,
|
||||||
|
"\" rx=\"", rx, "\" ry=\"", ry, "\" ");
|
||||||
|
} else {
|
||||||
|
write("<path d=\"");
|
||||||
|
PathIterator segments = s.getPathIterator(null);
|
||||||
|
double[] coords = new double[6];
|
||||||
|
for (int i = 0; !segments.isDone(); i++, segments.next()) {
|
||||||
|
if (i > 0) {
|
||||||
|
write(" ");
|
||||||
|
}
|
||||||
|
int segmentType = segments.currentSegment(coords);
|
||||||
|
switch (segmentType) {
|
||||||
|
case PathIterator.SEG_MOVETO:
|
||||||
|
write("M", coords[0], ",", coords[1]);
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_LINETO:
|
||||||
|
write("L", coords[0], ",", coords[1]);
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CUBICTO:
|
||||||
|
write("C", coords[0], ",", coords[1], " ",
|
||||||
|
coords[2], ",", coords[3], " ",
|
||||||
|
coords[4], ",", coords[5]);
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_QUADTO:
|
||||||
|
write("Q", coords[0], ",", coords[1], " ",
|
||||||
|
coords[2], ",", coords[3]);
|
||||||
|
break;
|
||||||
|
case PathIterator.SEG_CLOSE:
|
||||||
|
write("Z");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unknown path operation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
write("\" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getSvg(Color c) {
|
||||||
|
String color = "rgb(" + c.getRed() + "," + c.getGreen() + "," +
|
||||||
|
c.getBlue() + ")";
|
||||||
|
if (c.getAlpha() < 255) {
|
||||||
|
double opacity = c.getAlpha()/255.0;
|
||||||
|
color += ";opacity:" + opacity;
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getSvg(BufferedImage bufferedImg) {
|
||||||
|
ByteArrayOutputStream data = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ImageIO.write(bufferedImg, "png", data);
|
||||||
|
} catch (IOException e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String dataBase64 = DatatypeConverter
|
||||||
|
.printBase64Binary(data.toByteArray());
|
||||||
|
return "data:image/png;base64," + dataBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getFooter() {
|
||||||
|
String footer = "";
|
||||||
|
// Close any previous transformation groups
|
||||||
|
if (isTransformed()) {
|
||||||
|
footer += "</g>\n";
|
||||||
|
}
|
||||||
|
footer += "</svg>\n";
|
||||||
|
return footer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String doc = super.toString();
|
||||||
|
doc = doc.replaceAll("<g transform=\"[^\"]*\"></g>\n", "");
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
}
|
957
de/erichseifert/vectorgraphics2d/VectorGraphics2D.java
Normal file
@ -0,0 +1,957 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.GraphicsConfiguration;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.MultipleGradientPaint;
|
||||||
|
import java.awt.Paint;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.Stroke;
|
||||||
|
import java.awt.font.FontRenderContext;
|
||||||
|
import java.awt.font.GlyphVector;
|
||||||
|
import java.awt.font.TextLayout;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.Arc2D;
|
||||||
|
import java.awt.geom.Area;
|
||||||
|
import java.awt.geom.Ellipse2D;
|
||||||
|
import java.awt.geom.Line2D;
|
||||||
|
import java.awt.geom.Path2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
import java.awt.image.AffineTransformOp;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.BufferedImageOp;
|
||||||
|
import java.awt.image.ImageObserver;
|
||||||
|
import java.awt.image.RenderedImage;
|
||||||
|
import java.awt.image.renderable.RenderableImage;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.text.AttributedCharacterIterator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base for classed that want to implement vector export.
|
||||||
|
* @author Erich Seifert
|
||||||
|
*/
|
||||||
|
public abstract class VectorGraphics2D extends Graphics2D {
|
||||||
|
/** Constants to define how fonts are rendered. */
|
||||||
|
public static enum FontRendering {
|
||||||
|
/** Constant indicating that fonts should be rendered as
|
||||||
|
text objects. */
|
||||||
|
TEXT,
|
||||||
|
/** Constant indicating that fonts should be converted to vectors. */
|
||||||
|
VECTORS
|
||||||
|
}
|
||||||
|
/** Maximal resolution for image rastering. */
|
||||||
|
private static final int DEFAULT_PAINT_IMAGE_SIZE_MAXIMUM = 128;
|
||||||
|
|
||||||
|
/** Document contents. */
|
||||||
|
private final StringBuffer document;
|
||||||
|
/** Rectangular bounds of the documents. */
|
||||||
|
private final Rectangle2D bounds;
|
||||||
|
/** Resolution in dots per inch that is used to raster paints. */
|
||||||
|
private double resolution;
|
||||||
|
/** Maximal size of images that are used to raster paints. */
|
||||||
|
private int rasteredImageSizeMaximum;
|
||||||
|
/** Font rendering mode. */
|
||||||
|
private FontRendering fontRendering;
|
||||||
|
/** Flag that stores whether affine transformations have been applied. */
|
||||||
|
private boolean transformed;
|
||||||
|
|
||||||
|
/** Rendering hints. */
|
||||||
|
private final RenderingHints hints;
|
||||||
|
/** Current background color. */
|
||||||
|
private Color background;
|
||||||
|
/** Current foreground color. */
|
||||||
|
private Color color;
|
||||||
|
/** Shape used for clipping paint operations. */
|
||||||
|
private Shape clip;
|
||||||
|
/** Method used for compositing. */
|
||||||
|
private Composite composite;
|
||||||
|
/** Device configuration settings. */
|
||||||
|
private final GraphicsConfiguration deviceConfig;
|
||||||
|
/** Current font. */
|
||||||
|
private Font font;
|
||||||
|
/** Context settings used to render fonts. */
|
||||||
|
private final FontRenderContext fontRenderContext;
|
||||||
|
/** Paint used to fill shapes. */
|
||||||
|
private Paint paint;
|
||||||
|
/** Stroke used for drawing shapes. */
|
||||||
|
private Stroke stroke;
|
||||||
|
/** Current transformation matrix. */
|
||||||
|
private final AffineTransform transform;
|
||||||
|
/** XOR mode used for rendering. */
|
||||||
|
private Color xorMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor to initialize a new {@code VectorGraphics2D} document.
|
||||||
|
* The dimensions of the document must be passed.
|
||||||
|
* @param x Horizontal position of document origin.
|
||||||
|
* @param y Vertical position of document origin.
|
||||||
|
* @param width Width of document.
|
||||||
|
* @param height Height of document.
|
||||||
|
*/
|
||||||
|
public VectorGraphics2D(double x, double y, double width, double height) {
|
||||||
|
hints = new RenderingHints(new HashMap<RenderingHints.Key, Object>());
|
||||||
|
document = new StringBuffer();
|
||||||
|
bounds = new Rectangle2D.Double(x, y, width, height);
|
||||||
|
fontRendering = FontRendering.TEXT;
|
||||||
|
resolution = 72.0;
|
||||||
|
rasteredImageSizeMaximum = DEFAULT_PAINT_IMAGE_SIZE_MAXIMUM;
|
||||||
|
|
||||||
|
background = Color.WHITE;
|
||||||
|
color = Color.BLACK;
|
||||||
|
composite = AlphaComposite.getInstance(AlphaComposite.CLEAR);
|
||||||
|
deviceConfig = null;
|
||||||
|
font = Font.decode(null);
|
||||||
|
fontRenderContext = new FontRenderContext(null, false, true);
|
||||||
|
paint = color;
|
||||||
|
stroke = new BasicStroke(1f);
|
||||||
|
transform = new AffineTransform();
|
||||||
|
transformed = false;
|
||||||
|
xorMode = Color.BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRenderingHints(Map<?,?> hints) {
|
||||||
|
this.hints.putAll(hints);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clip(Shape s) {
|
||||||
|
if ((getClip() != null) && (s != null)) {
|
||||||
|
Area clipAreaOld = new Area(getClip());
|
||||||
|
Area clipAreaNew = new Area(s);
|
||||||
|
clipAreaNew.intersect(clipAreaOld);
|
||||||
|
s = clipAreaNew;
|
||||||
|
}
|
||||||
|
setClip(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Shape s) {
|
||||||
|
writeShape(s);
|
||||||
|
writeClosingDraw(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGlyphVector(GlyphVector g, float x, float y) {
|
||||||
|
draw(g.getOutline(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, AffineTransform xform,
|
||||||
|
ImageObserver obs) {
|
||||||
|
BufferedImage bimg = getTransformedImage(img, xform);
|
||||||
|
drawImage(bimg, null, bimg.getMinX(), bimg.getMinY());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawImage(BufferedImage img, BufferedImageOp op,
|
||||||
|
int x, int y) {
|
||||||
|
if (op != null) {
|
||||||
|
img = op.filter(img, null);
|
||||||
|
}
|
||||||
|
drawImage(img, x, y, img.getWidth(), img.getHeight(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawRenderableImage(RenderableImage img,
|
||||||
|
AffineTransform xform) {
|
||||||
|
drawRenderedImage(img.createDefaultRendering(), xform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawRenderedImage(RenderedImage img,
|
||||||
|
AffineTransform xform) {
|
||||||
|
// TODO Implement
|
||||||
|
//throw new UnsupportedOperationException("Rendered images aren't supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawString(String str, int x, int y) {
|
||||||
|
drawString(str, (float) x, (float) y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawString(String str, float x, float y) {
|
||||||
|
if (str != null && str.trim().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (getFontRendering()) {
|
||||||
|
case VECTORS:
|
||||||
|
TextLayout layout = new TextLayout(str, getFont(),
|
||||||
|
getFontRenderContext());
|
||||||
|
Shape s = layout.getOutline(
|
||||||
|
AffineTransform.getTranslateInstance(x, y));
|
||||||
|
fill(s);
|
||||||
|
break;
|
||||||
|
case TEXT:
|
||||||
|
writeString(str, x, y);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException("Unknown font rendering mode.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawString(AttributedCharacterIterator iterator,
|
||||||
|
int x, int y) {
|
||||||
|
drawString(iterator, (float) x, (float) y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawString(AttributedCharacterIterator iterator,
|
||||||
|
float x, float y) {
|
||||||
|
// TODO Take text formatting into account
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
for (char c = iterator.first(); c != AttributedCharacterIterator.DONE;
|
||||||
|
c = iterator.next()) {
|
||||||
|
buf.append(c);
|
||||||
|
}
|
||||||
|
drawString(buf.toString(), x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fill(Shape s) {
|
||||||
|
writeShape(s);
|
||||||
|
writeClosingFill(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getBackground() {
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Composite getComposite() {
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GraphicsConfiguration getDeviceConfiguration() {
|
||||||
|
return deviceConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FontRenderContext getFontRenderContext() {
|
||||||
|
return fontRenderContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Paint getPaint() {
|
||||||
|
return paint;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getRenderingHint(RenderingHints.Key hintKey) {
|
||||||
|
if (RenderingHints.KEY_ANTIALIASING.equals(hintKey)) {
|
||||||
|
return RenderingHints.VALUE_ANTIALIAS_OFF;
|
||||||
|
} else if (RenderingHints.KEY_TEXT_ANTIALIASING.equals(hintKey)) {
|
||||||
|
return RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
|
||||||
|
} else if (RenderingHints.KEY_FRACTIONALMETRICS.equals(hintKey)) {
|
||||||
|
return RenderingHints.VALUE_FRACTIONALMETRICS_ON;
|
||||||
|
}
|
||||||
|
return hints.get(hintKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RenderingHints getRenderingHints() {
|
||||||
|
return hints;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stroke getStroke() {
|
||||||
|
return stroke;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
|
||||||
|
if (onStroke) {
|
||||||
|
Shape sStroke = getStroke().createStrokedShape(s);
|
||||||
|
return sStroke.intersects(rect);
|
||||||
|
} else {
|
||||||
|
return s.intersects(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBackground(Color color) {
|
||||||
|
background = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setComposite(Composite comp) {
|
||||||
|
composite = comp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPaint(Paint paint) {
|
||||||
|
if (paint != null) {
|
||||||
|
this.paint = paint;
|
||||||
|
if (paint instanceof Color) {
|
||||||
|
setColor((Color) paint);
|
||||||
|
} else if (paint instanceof MultipleGradientPaint) {
|
||||||
|
// Set brightest or least opaque color for gradients
|
||||||
|
Color[] colors = ((MultipleGradientPaint) paint).getColors();
|
||||||
|
if (colors.length == 1) {
|
||||||
|
setColor(colors[0]);
|
||||||
|
} else if (colors.length > 1) {
|
||||||
|
Color colLight = colors[0];
|
||||||
|
float brightness = getBrightness(colLight);
|
||||||
|
int alpha = colLight.getAlpha();
|
||||||
|
|
||||||
|
for (int i = 1; i < colors.length; i++) {
|
||||||
|
Color c = colors[i];
|
||||||
|
float b = getBrightness(c);
|
||||||
|
int a = c.getAlpha();
|
||||||
|
if (b < brightness || a < alpha) {
|
||||||
|
colLight = c;
|
||||||
|
brightness = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setColor(colLight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method to get the brightness of a specified color.
|
||||||
|
* @param c Color.
|
||||||
|
* @return Brightness value between 0f (black) and 1f (white).
|
||||||
|
*/
|
||||||
|
private static float getBrightness(Color c) {
|
||||||
|
return Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null)[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) {
|
||||||
|
hints.put(hintKey, hintValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRenderingHints(Map<?, ?> hints) {
|
||||||
|
this.hints.putAll(hints);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStroke(Stroke s) {
|
||||||
|
stroke = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AffineTransform getTransform() {
|
||||||
|
return new AffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTransform(AffineTransform tx) {
|
||||||
|
setAffineTransform(tx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current transformation.
|
||||||
|
* @param tx Current transformation
|
||||||
|
*/
|
||||||
|
protected void setAffineTransform(AffineTransform tx) {
|
||||||
|
if (!transform.equals(tx)) {
|
||||||
|
transform.setTransform(tx);
|
||||||
|
transformed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shear(double shx, double shy) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.shear(shx, shy);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(AffineTransform tx) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.concatenate(tx);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void translate(int x, int y) {
|
||||||
|
translate((double) x, (double) y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void translate(double tx, double ty) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.translate(tx, ty);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(double theta) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.rotate(theta);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rotate(double theta, double x, double y) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.rotate(theta, x, y);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scale(double sx, double sy) {
|
||||||
|
AffineTransform transform = getTransform();
|
||||||
|
transform.scale(sx, sy);
|
||||||
|
setAffineTransform(transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clearRect(int x, int y, int width, int height) {
|
||||||
|
// TODO Implement
|
||||||
|
//throw new UnsupportedOperationException("clearRect() isn't supported by VectorGraphics2D.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clipRect(int x, int y, int width, int height) {
|
||||||
|
clip(new Rectangle(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void copyArea(int x, int y, int width, int height, int dx, int dy) {
|
||||||
|
// TODO Implement
|
||||||
|
//throw new UnsupportedOperationException("copyArea() isn't supported by VectorGraphics2D.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Graphics create() {
|
||||||
|
// TODO Implement
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
// TODO Implement
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawArc(int x, int y, int width, int height,
|
||||||
|
int startAngle, int arcAngle) {
|
||||||
|
draw(new Arc2D.Double(x, y, width, height,
|
||||||
|
startAngle, arcAngle, Arc2D.OPEN));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
|
||||||
|
return drawImage(img, x, y,
|
||||||
|
img.getWidth(observer), img.getHeight(observer), observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int x, int y, Color bgcolor,
|
||||||
|
ImageObserver observer) {
|
||||||
|
return drawImage(img, x, y,
|
||||||
|
img.getWidth(observer), img.getHeight(observer), observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int x, int y, int width, int height,
|
||||||
|
ImageObserver observer) {
|
||||||
|
int imgWidth = img.getWidth(observer);
|
||||||
|
int imgHeight = img.getHeight(observer);
|
||||||
|
writeImage(img, imgWidth, imgHeight, x, y, width, height);
|
||||||
|
return true; // TODO Return only true if image data was complete
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int x, int y, int width, int height,
|
||||||
|
Color bgcolor, ImageObserver observer) {
|
||||||
|
return drawImage(img, x, y, width, height, observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
|
||||||
|
int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {
|
||||||
|
if (img == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sx = Math.min(sx1, sx2);
|
||||||
|
int sy = Math.min(sy1, sy2);
|
||||||
|
int sw = Math.abs(sx2 - sx1);
|
||||||
|
int sh = Math.abs(sy2 - sy1);
|
||||||
|
int dx = Math.min(dx1, dx2);
|
||||||
|
int dy = Math.min(dy1, dy2);
|
||||||
|
int dw = Math.abs(dx2 - dx1);
|
||||||
|
int dh = Math.abs(dy2 - dy1);
|
||||||
|
|
||||||
|
// Draw image
|
||||||
|
BufferedImage bufferedImg = GraphicsUtils.toBufferedImage(img);
|
||||||
|
Image cropped = bufferedImg.getSubimage(sx, sy, sw, sh);
|
||||||
|
return drawImage(cropped, dx, dy, dw, dh, observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,
|
||||||
|
int sx1, int sy1, int sx2, int sy2, Color bgcolor,
|
||||||
|
ImageObserver observer) {
|
||||||
|
if (img == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sx = Math.min(sx1, sx2);
|
||||||
|
int sy = Math.min(sy1, sy2);
|
||||||
|
int sw = Math.abs(sx2 - sx1);
|
||||||
|
int sh = Math.abs(sy2 - sy1);
|
||||||
|
int dx = Math.min(dx1, dx2);
|
||||||
|
int dy = Math.min(dy1, dy2);
|
||||||
|
int dw = Math.abs(dx2 - dx1);
|
||||||
|
int dh = Math.abs(dy2 - dy1);
|
||||||
|
|
||||||
|
// Fill Rectangle with bgcolor
|
||||||
|
Color bgcolorOld = getColor();
|
||||||
|
setColor(bgcolor);
|
||||||
|
fill(new Rectangle(dx, dy, dw, dh));
|
||||||
|
setColor(bgcolorOld);
|
||||||
|
|
||||||
|
// Draw image on rectangle
|
||||||
|
BufferedImage bufferedImg = GraphicsUtils.toBufferedImage(img);
|
||||||
|
Image cropped = bufferedImg.getSubimage(sx, sy, sw, sh);
|
||||||
|
return drawImage(cropped, dx, dy, dw, dh, observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLine(int x1, int y1, int x2, int y2) {
|
||||||
|
draw(new Line2D.Double(x1, y1, x2, y2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawOval(int x, int y, int width, int height) {
|
||||||
|
draw(new Ellipse2D.Double(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D p = new Path2D.Float();
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
p.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
p.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.closePath();
|
||||||
|
draw(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D p = new Path2D.Float();
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
p.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
p.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
draw(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawRect(int x, int y, int width, int height) {
|
||||||
|
draw(new Rectangle2D.Double(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawRoundRect(int x, int y, int width, int height,
|
||||||
|
int arcWidth, int arcHeight) {
|
||||||
|
draw(new RoundRectangle2D.Double(x, y, width, height,
|
||||||
|
arcWidth, arcHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillArc(int x, int y, int width, int height,
|
||||||
|
int startAngle, int arcAngle) {
|
||||||
|
fill(new Arc2D.Double(x, y, width, height,
|
||||||
|
startAngle, arcAngle, Arc2D.PIE));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillOval(int x, int y, int width, int height) {
|
||||||
|
fill(new Ellipse2D.Double(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
|
||||||
|
Path2D p = new Path2D.Float();
|
||||||
|
for (int i = 0; i < nPoints; i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
p.lineTo(xPoints[i], yPoints[i]);
|
||||||
|
} else {
|
||||||
|
p.moveTo(xPoints[i], yPoints[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.closePath();
|
||||||
|
|
||||||
|
fill(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillRect(int x, int y, int width, int height) {
|
||||||
|
fill(new Rectangle2D.Double(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fillRoundRect(int x, int y, int width, int height,
|
||||||
|
int arcWidth, int arcHeight) {
|
||||||
|
fill(new RoundRectangle2D.Double(x, y, width, height,
|
||||||
|
arcWidth, arcHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Shape getClip() {
|
||||||
|
return clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Rectangle getClipBounds() {
|
||||||
|
if (clip == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return clip.getBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Font getFont() {
|
||||||
|
return font;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FontMetrics getFontMetrics(Font f) {
|
||||||
|
// TODO Find a better way for creating a new FontMetrics instance
|
||||||
|
BufferedImage bi =
|
||||||
|
new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB_PRE);
|
||||||
|
Graphics g = bi.getGraphics();
|
||||||
|
FontMetrics fontMetrics = g.getFontMetrics(font);
|
||||||
|
g.dispose();
|
||||||
|
bi = null;
|
||||||
|
return fontMetrics;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClip(Shape clip) {
|
||||||
|
this.clip = clip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setClip(int x, int y, int width, int height) {
|
||||||
|
setClip(new Rectangle(x, y, width, height));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColor(Color c) {
|
||||||
|
color = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFont(Font font) {
|
||||||
|
if (!this.font.equals(font)) {
|
||||||
|
this.font = font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPaintMode() {
|
||||||
|
// TODO Implement
|
||||||
|
//throw new UnsupportedOperationException("setPaintMode() isn't supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setXORMode(Color c1) {
|
||||||
|
xorMode = c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing multiple objects to the SVG document.
|
||||||
|
* @param strs Objects to be written
|
||||||
|
*/
|
||||||
|
protected void write(Object... strs) {
|
||||||
|
for (Object o : strs) {
|
||||||
|
String str = o.toString();
|
||||||
|
if ((o instanceof Double) || (o instanceof Float)) {
|
||||||
|
str = String.format(Locale.ENGLISH, "%.7f", o)
|
||||||
|
.replaceAll("\\.?0+$", "");
|
||||||
|
}
|
||||||
|
document.append(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility method for writing a line of multiple objects to the
|
||||||
|
* SVG document.
|
||||||
|
* @param strs Objects to be written
|
||||||
|
*/
|
||||||
|
protected void writeln(Object... strs) {
|
||||||
|
write(strs);
|
||||||
|
write("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the specified shape to the document. This does not necessarily
|
||||||
|
* contain the actual command to paint the shape.
|
||||||
|
* @param s Shape to be written.
|
||||||
|
*/
|
||||||
|
protected abstract void writeShape(Shape s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the specified image to the document. A number of dimensions will
|
||||||
|
* specify how the image will be placed in the document.
|
||||||
|
* @param img Image to be rendered.
|
||||||
|
* @param imgWidth Number of pixels in horizontal direction.
|
||||||
|
* @param imgHeight Number of pixels in vertical direction
|
||||||
|
* @param x Horizontal position in document units where the
|
||||||
|
* upper left corner of the image should be placed.
|
||||||
|
* @param y Vertical position in document units where the
|
||||||
|
* upper left corner of the image should be placed.
|
||||||
|
* @param width Width of the image in document units.
|
||||||
|
* @param height Height of the image in document units.
|
||||||
|
*/
|
||||||
|
protected abstract void writeImage(Image img, int imgWidth, int imgHeight,
|
||||||
|
double x, double y, double width, double height);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a text string to the document at a specified position.
|
||||||
|
* @param str Text to be rendered.
|
||||||
|
* @param x Horizontal position in document units.
|
||||||
|
* @param y Vertical position in document units.
|
||||||
|
*/
|
||||||
|
protected abstract void writeString(String str, double x, double y);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a command to draw the outline of a previously inserted shape.
|
||||||
|
* @param s Shape that should be drawn.
|
||||||
|
*/
|
||||||
|
protected abstract void writeClosingDraw(Shape s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a command to fill the outline of a previously inserted shape.
|
||||||
|
* @param s Shape that should be filled.
|
||||||
|
*/
|
||||||
|
protected void writeClosingFill(Shape s) {
|
||||||
|
Rectangle2D shapeBounds = s.getBounds2D();
|
||||||
|
|
||||||
|
// Calculate dimensions of shape with current transformations
|
||||||
|
int wImage = (int) Math.ceil(shapeBounds.getWidth()*getResolution());
|
||||||
|
int hImage = (int) Math.ceil(shapeBounds.getHeight()*getResolution());
|
||||||
|
// Limit the size of images
|
||||||
|
wImage = Math.min(wImage, rasteredImageSizeMaximum);
|
||||||
|
hImage = Math.min(hImage, rasteredImageSizeMaximum);
|
||||||
|
|
||||||
|
// Create image to paint draw gradient with current transformations
|
||||||
|
BufferedImage paintImage = new BufferedImage(
|
||||||
|
wImage, hImage, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
|
// Paint shape
|
||||||
|
Graphics2D g = (Graphics2D) paintImage.getGraphics();
|
||||||
|
g.scale(wImage/shapeBounds.getWidth(), hImage/shapeBounds.getHeight());
|
||||||
|
g.translate(-shapeBounds.getX(), -shapeBounds.getY());
|
||||||
|
g.setPaint(getPaint());
|
||||||
|
g.fill(s);
|
||||||
|
// Free resources
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
|
// Output image of gradient
|
||||||
|
writeImage(paintImage, wImage, hImage,
|
||||||
|
shapeBounds.getX(), shapeBounds.getY(),
|
||||||
|
shapeBounds.getWidth(), shapeBounds.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the header to start a new document.
|
||||||
|
*/
|
||||||
|
protected abstract void writeHeader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string of the footer to end a document.
|
||||||
|
*/
|
||||||
|
protected abstract String getFooter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a transformed version of an image.
|
||||||
|
* @param image Image to be transformed
|
||||||
|
* @param xform Affine transform to be applied
|
||||||
|
* @return Image with transformed content
|
||||||
|
*/
|
||||||
|
private BufferedImage getTransformedImage(Image image,
|
||||||
|
AffineTransform xform) {
|
||||||
|
Integer interpolationType =
|
||||||
|
(Integer) hints.get(RenderingHints.KEY_INTERPOLATION);
|
||||||
|
if (RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
||||||
|
.equals(interpolationType)) {
|
||||||
|
interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
|
||||||
|
} else if (RenderingHints.VALUE_INTERPOLATION_BILINEAR
|
||||||
|
.equals(interpolationType)) {
|
||||||
|
interpolationType = AffineTransformOp.TYPE_BILINEAR;
|
||||||
|
} else {
|
||||||
|
interpolationType = AffineTransformOp.TYPE_BICUBIC;
|
||||||
|
}
|
||||||
|
AffineTransformOp op = new AffineTransformOp(xform, interpolationType);
|
||||||
|
BufferedImage bufferedImage = GraphicsUtils.toBufferedImage(image);
|
||||||
|
return op.filter(bufferedImage, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether a distorting transformation has been applied to the
|
||||||
|
* document.
|
||||||
|
* @return <code>true</code> if the document is distorted,
|
||||||
|
* otherwise <code>false</code>.
|
||||||
|
*/
|
||||||
|
protected boolean isDistorted() {
|
||||||
|
if (!isTransformed()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int type = transform.getType();
|
||||||
|
int otherButTranslatedOrScaled = ~(AffineTransform.TYPE_TRANSLATION
|
||||||
|
| AffineTransform.TYPE_MASK_SCALE);
|
||||||
|
return (type & otherButTranslatedOrScaled) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return document.toString() + getFooter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encodes the painted data into a sequence of bytes.
|
||||||
|
* @return A byte array containing the data in the current file format.
|
||||||
|
*/
|
||||||
|
public byte[] getBytes() {
|
||||||
|
try {
|
||||||
|
return toString().getBytes("UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
return toString().getBytes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the dimensions of the document.
|
||||||
|
* @return dimensions of the document.
|
||||||
|
*/
|
||||||
|
public Rectangle2D getBounds() {
|
||||||
|
Rectangle2D b = new Rectangle2D.Double();
|
||||||
|
b.setFrame(bounds);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of bytes of the document.
|
||||||
|
* @return size of the document in bytes.
|
||||||
|
*/
|
||||||
|
protected int size() {
|
||||||
|
return document.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns how fonts should be rendered.
|
||||||
|
* @return Font rendering mode.
|
||||||
|
*/
|
||||||
|
public FontRendering getFontRendering() {
|
||||||
|
return fontRendering;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets how fonts should be rendered. For example, they can be converted
|
||||||
|
* to vector shapes.
|
||||||
|
* @param mode New font rendering mode.
|
||||||
|
*/
|
||||||
|
public void setFontRendering(FontRendering mode) {
|
||||||
|
fontRendering = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether an affine transformation like translation, scaling,
|
||||||
|
* rotation or shearing has been applied to this graphics instance.
|
||||||
|
* @return <code>true</code> if the instance has been transformed,
|
||||||
|
* <code>false</code> otherwise
|
||||||
|
*/
|
||||||
|
protected boolean isTransformed() {
|
||||||
|
return transformed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the resolution in pixels per inch.
|
||||||
|
* @return Resolution in pixels per inch.
|
||||||
|
*/
|
||||||
|
public double getResolution() {
|
||||||
|
return resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the resolution in pixels per inch.
|
||||||
|
* @param resolution New resolution in pixels per inch.
|
||||||
|
*/
|
||||||
|
public void setResolution(double resolution) {
|
||||||
|
if (resolution <= 0.0) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Only positive non-zero values allowed");
|
||||||
|
}
|
||||||
|
this.resolution = resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximal size of images which are used to raster paints
|
||||||
|
* like e.g. gradients, or patterns. The default value is 128.
|
||||||
|
* @return Current maximal image size in pixels.
|
||||||
|
*/
|
||||||
|
public int getRasteredImageSizeMaximum() {
|
||||||
|
return rasteredImageSizeMaximum;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the maximal size of images which are used to raster paints
|
||||||
|
* like e.g. gradients, or patterns.
|
||||||
|
* @param paintImageSizeMaximum New maximal image size in pixels.
|
||||||
|
*/
|
||||||
|
public void setRasteredImageSizeMaximum(int paintImageSizeMaximum) {
|
||||||
|
this.rasteredImageSizeMaximum = paintImageSizeMaximum;
|
||||||
|
}
|
||||||
|
}
|
25
de/erichseifert/vectorgraphics2d/package-info.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* VectorGraphics2D: Vector export for Java(R) Graphics2D
|
||||||
|
*
|
||||||
|
* (C) Copyright 2010 Erich Seifert <dev[at]erichseifert.de>
|
||||||
|
*
|
||||||
|
* This file is part of VectorGraphics2D.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* VectorGraphics2D 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 Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with VectorGraphics2D. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main classes.
|
||||||
|
*/
|
||||||
|
package de.erichseifert.vectorgraphics2d;
|
69
default.mcr
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<CaR>
|
||||||
|
<Macro Name="Complements/Angle Bisector as Ray">
|
||||||
|
<Parameter name="P1">Point on first leg of angle</Parameter>
|
||||||
|
<Parameter name="P2">Vertex of angle</Parameter>
|
||||||
|
<Parameter name="P3">Point on second leg of angle</Parameter>
|
||||||
|
<Comment>
|
||||||
|
<P>Angle bisector of angle P1P2P3 as ray.</P>
|
||||||
|
</Comment>
|
||||||
|
<Objects>
|
||||||
|
<Point name="P1" n="0" mainparameter="true" x="-4.100000000000001" y="4.26">Point à -4.1, 4.26</Point>
|
||||||
|
<Point name="P2" n="1" mainparameter="true" x="-0.5250000000000008" y="-2.6875">Point à -0.53, -2.69</Point>
|
||||||
|
<Point name="P3" n="2" mainparameter="true" x="3.425000000000001" y="2.7875">Point à 3.43, 2.79</Point>
|
||||||
|
<Ray name="r1" n="3" hidden="super" from="P2" to="P1">Strahl von P2 in Richtung P1</Ray>
|
||||||
|
<Circle name="k1" n="4" hidden="super" through="P3" midpoint="P2" acute="true">Kreis um P2 durch P3</Circle>
|
||||||
|
<Intersection name="S1" n="5" hidden="super" first="r1" second="k1" which="first">Schnitt zwischen r1 und k1</Intersection>
|
||||||
|
<Midpoint name="M1" n="6" hidden="super" first="S1" second="P3">Mitte zwischen S1 und P3</Midpoint>
|
||||||
|
<Ray name="r2" n="7" target="true" from="P2" to="M1">Strahl von P2 in Richtung M1</Ray>
|
||||||
|
</Objects>
|
||||||
|
</Macro>
|
||||||
|
<Macro Name="Complements/Projection of Point to Line">
|
||||||
|
<Parameter name="g1">Line to project to</Parameter>
|
||||||
|
<Parameter name="P3">Projected point</Parameter>
|
||||||
|
<Comment>
|
||||||
|
<P>Projects P to the line g.</P>
|
||||||
|
</Comment>
|
||||||
|
<Objects>
|
||||||
|
<Line name="g1" n="0" mainparameter="true">???</Line>
|
||||||
|
<Point name="P3" n="1" mainparameter="true" x="1.675041876046901" y="2.46566164154104">Point à 1.68, 2.47</Point>
|
||||||
|
<Plumb name="l1" n="2" hidden="super" point="P3" line="g1" valid="true">Lot durch P3 zu g1</Plumb>
|
||||||
|
<Intersection name="S1" n="3" target="true" first="g1" second="l1">Schnitt zwischen g1 und l1</Intersection>
|
||||||
|
</Objects>
|
||||||
|
</Macro>
|
||||||
|
<Macro Name="Complements/Rotation">
|
||||||
|
<Parameter name="P1">Point on first leg of angle</Parameter>
|
||||||
|
<Parameter name="P2">Vertex of angle</Parameter>
|
||||||
|
<Parameter name="P3">Point on second leg of angle</Parameter>
|
||||||
|
<Parameter name="P4">Rotation center</Parameter>
|
||||||
|
<Parameter name="P5">Rotating point</Parameter>
|
||||||
|
<Comment>
|
||||||
|
<P>Rotate a point P around Q with angle ABC.</P>
|
||||||
|
</Comment>
|
||||||
|
<Objects>
|
||||||
|
<Point name="P1" n="0" mainparameter="true" x="2.8526100000000008" y="-3.271">Point à 2.85, -3.27</Point>
|
||||||
|
<Point name="P2" n="1" mainparameter="true" x="-3.689381933438986" y="-3.3217115689381935">Point à -3.69, -3.32</Point>
|
||||||
|
<Point name="P3" n="2" mainparameter="true" x="2.3454800000000002" y="-0.9128400000000001">Point à 2.35, -0.91</Point>
|
||||||
|
<Point name="P4" n="3" mainparameter="true" x="-3.942947702060222" y="0.6085578446909674">Point à -3.94, 0.61</Point>
|
||||||
|
<Point name="P5" n="4" mainparameter="true" x="1.2044400000000004" y="2.71315">Point à 1.2, 2.71</Point>
|
||||||
|
<Angle name="w1" n="5" color="1" hidden="super" first="P5" root="P4" fixed="a(P1,P2,P3)">Angle P5 - P4 de mesure a(P1,P2,P3)</Angle>
|
||||||
|
<Circle name="k1" n="6" color="1" hidden="super" through="P5" midpoint="P4" acute="true">Circle P4 through P5</Circle>
|
||||||
|
<Intersection name="S1" n="7" color="1" target="true" first="w1" second="k1" which="first">Intersection w1 and k1</Intersection>
|
||||||
|
</Objects>
|
||||||
|
</Macro>
|
||||||
|
<Macro Name="Complements/Rotation with angle">
|
||||||
|
<Parameter name="P1">Center of rotation</Parameter>
|
||||||
|
<Parameter name="P2">Rotating point</Parameter>
|
||||||
|
<Comment>
|
||||||
|
<P>Rotates a point P around Q with a given angle.</P>
|
||||||
|
</Comment>
|
||||||
|
<Objects>
|
||||||
|
<Point name="P1" n="0" mainparameter="true" x="-4.221870047543582" y="-0.48177496038034834">Point à -4.22, -0.48</Point>
|
||||||
|
<Point name="P2" n="1" mainparameter="true" x="2.244057052297941" y="0.4564183835182246">Point à 2.24, 0.46</Point>
|
||||||
|
<Angle name="w1" n="2" hidden="super" first="P2" root="P1" fixed="16">Angle P2 - P1 de mesure 16</Angle>
|
||||||
|
<Circle name="k1" n="3" hidden="super" through="P2" midpoint="P1" acute="true">Circle around P1 through P2</Circle>
|
||||||
|
<Intersection name="S1" n="4" target="true" first="w1" second="k1" which="first">Intersection of w1 and k1</Intersection>
|
||||||
|
</Objects>
|
||||||
|
<PromptFor object0="w1" prompt0="w1"/>
|
||||||
|
</Macro>
|
||||||
|
</CaR>
|
BIN
eric/.DS_Store
vendored
Normal file
1194
eric/FileTools.java
Normal file
BIN
eric/GUI/.DS_Store
vendored
Normal file
55
eric/GUI/ZDialog/ZButton.java
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import rene.gui.Global;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZButton extends JButton {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZButton(String lbl) {
|
||||||
|
super(lbl);
|
||||||
|
setOpaque(false);
|
||||||
|
setFont(new Font(Global.GlobalFont, 0, 11));
|
||||||
|
addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void action() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pressed(final ZButton button) {
|
||||||
|
class pressed implements Runnable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
button.setEnabled(false);
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException ex) {}
|
||||||
|
button.setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
new Thread(new pressed()).start();
|
||||||
|
}
|
||||||
|
}
|
70
eric/GUI/ZDialog/ZCheckBox.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import eric.GUI.themes;
|
||||||
|
import eric.JZirkelCanvas;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import rene.zirkel.ZirkelCanvas;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZCheckBox extends JLabel {
|
||||||
|
|
||||||
|
private boolean selected;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
|
||||||
|
super.paintComponent(g);
|
||||||
|
if (selected) {
|
||||||
|
g.drawImage(themes.getImage("chkboxON.gif"), 0, 2, this);
|
||||||
|
} else {
|
||||||
|
g.drawImage(themes.getImage("chkboxOFF.gif"), 0, 2, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZCheckBox(String lbl, boolean value) {
|
||||||
|
super(lbl);
|
||||||
|
selected=value;
|
||||||
|
setFont(ZTools.ZCheckBoxFont);
|
||||||
|
setFocusable(false);
|
||||||
|
setIcon(themes.getIcon("pixel"));
|
||||||
|
setIconTextGap(20);
|
||||||
|
setVerticalTextPosition(SwingConstants.CENTER);
|
||||||
|
setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
setSelected(!selected);
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSelected() {
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelected(boolean b) {
|
||||||
|
selected=b;
|
||||||
|
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||||
|
if (zc!=null) {
|
||||||
|
zc.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void action() {
|
||||||
|
}
|
||||||
|
}
|
263
eric/GUI/ZDialog/ZDialog.java
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import eric.GUI.windowComponent;
|
||||||
|
import eric.JEricPanel;
|
||||||
|
import eric.JZirkelCanvas;
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.MouseInfo;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseMotionAdapter;
|
||||||
|
import java.awt.geom.RoundRectangle2D;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import rene.zirkel.ZirkelCanvas;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake, lightly modified by PM Mazat
|
||||||
|
*/
|
||||||
|
public class ZDialog extends JEricPanel {
|
||||||
|
|
||||||
|
private ZDialog me;
|
||||||
|
//private RoundRectangle2D roundRect;
|
||||||
|
protected RoundRectangle2D roundRect;
|
||||||
|
//private int cx=0, cy=0, cw=0;
|
||||||
|
protected int cx=0, cy=0, cw=0;
|
||||||
|
private Point origin, winloc;
|
||||||
|
public int D_X, D_Y, D_WIDTH, D_HEIGHT; // Dialog width and height
|
||||||
|
private boolean withTitle=false;
|
||||||
|
private ZDialogTitle title;
|
||||||
|
private boolean withCloseBox=false;
|
||||||
|
private ZDialogCloseBox closebox;
|
||||||
|
//private boolean boxEnter=false;
|
||||||
|
protected boolean boxEnter=false;
|
||||||
|
protected int THEIGHT=22;
|
||||||
|
protected int MARGINTOP1=THEIGHT+8; // Margin top for first component line
|
||||||
|
protected int MARGINTOP2=MARGINTOP1+26; // Margin top for second component line
|
||||||
|
protected int MARGINTOP3=MARGINTOP2+26; // Margin top for third component line
|
||||||
|
protected int MARGINTOP4=MARGINTOP3+26; // Margin top for forth component line
|
||||||
|
protected int MARGINTOP5=MARGINTOP4+26; // Margin top for forth component line
|
||||||
|
protected int ARCCORNER=20; // Round corner size
|
||||||
|
protected int LWIDTH=150; // Label width (for textfields)
|
||||||
|
protected int BWIDTH=90; // Button width
|
||||||
|
protected int CWIDTH=350; // Component width
|
||||||
|
protected int CHEIGHT=19; // Component height
|
||||||
|
protected int MARGINW=12; // Margin left and right
|
||||||
|
protected int NOT_EXIT = 28; //at least NOT_EXIT pixels will be visible
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
if (JZirkelCanvas.isPaintCalled()) {
|
||||||
|
|
||||||
|
Graphics2D g2d=windowComponent.getGraphics2D(g);
|
||||||
|
|
||||||
|
if (isTitleVisible()) {
|
||||||
|
// draw the title background :
|
||||||
|
g2d.setColor(ZTools.backTitleColor);
|
||||||
|
g2d.setClip(0, 0, D_WIDTH, THEIGHT);
|
||||||
|
g2d.fill(roundRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCloseBoxVisible()) {
|
||||||
|
// draw the close box :
|
||||||
|
g2d.setColor(ZTools.TitleTextColor);
|
||||||
|
if (boxEnter) {
|
||||||
|
g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
||||||
|
} else {
|
||||||
|
g2d.setStroke(new BasicStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
||||||
|
}
|
||||||
|
g2d.drawOval(cx, cy, cw, cw);
|
||||||
|
int dx=(int) (cw*(1-Math.cos(Math.PI/4)));
|
||||||
|
g2d.drawLine(cx+dx, cy+dx, cx+cw-dx, cy+cw-dx);
|
||||||
|
g2d.drawLine(cx+dx, cy+cw-dx, cx+cw-dx, cy+dx);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the content background :
|
||||||
|
g2d.setColor(ZTools.backMainColor);
|
||||||
|
g2d.setClip(0, THEIGHT, D_WIDTH, D_HEIGHT);
|
||||||
|
g2d.fill(roundRect);
|
||||||
|
|
||||||
|
g2d.setClip(0, 0, D_WIDTH, D_HEIGHT);
|
||||||
|
|
||||||
|
g2d.setColor(Color.black);
|
||||||
|
g2d.setStroke(new BasicStroke(0.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
|
||||||
|
g2d.draw(roundRect);
|
||||||
|
g2d.setStroke(new BasicStroke(1f));
|
||||||
|
|
||||||
|
paintChildren(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCloseBoxVisible() {
|
||||||
|
return withCloseBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCloseBoxVisible(boolean b) {
|
||||||
|
withCloseBox=b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTitleVisible() {
|
||||||
|
return withTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitleVisible(boolean b) {
|
||||||
|
withTitle=b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZDialog(String ttle, int x, int y, int w, int h, boolean withtitle, boolean withclose) {
|
||||||
|
me=this;
|
||||||
|
add(closebox=new ZDialogCloseBox());
|
||||||
|
add(title=new ZDialogTitle(ttle));
|
||||||
|
withTitle=withtitle;
|
||||||
|
withCloseBox=withclose;
|
||||||
|
if (!withtitle) {
|
||||||
|
MARGINTOP1=MARGINTOP1-THEIGHT;
|
||||||
|
MARGINTOP2=MARGINTOP2-THEIGHT;
|
||||||
|
MARGINTOP3=MARGINTOP3-THEIGHT;
|
||||||
|
MARGINTOP4=MARGINTOP4-THEIGHT;
|
||||||
|
THEIGHT=0;
|
||||||
|
}
|
||||||
|
D_X=x;
|
||||||
|
D_Y=y;
|
||||||
|
D_WIDTH=w;
|
||||||
|
D_HEIGHT=h;
|
||||||
|
roundRect=new RoundRectangle2D.Double(2, 2, D_WIDTH-4, D_HEIGHT-4, ARCCORNER, ARCCORNER);
|
||||||
|
|
||||||
|
setLayout(null);
|
||||||
|
setOpaque(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init() {
|
||||||
|
setBounds(D_X, D_Y, D_WIDTH, D_HEIGHT);
|
||||||
|
title.setBounds(0, 0, D_WIDTH, THEIGHT);
|
||||||
|
cw=THEIGHT-8;
|
||||||
|
cx=D_WIDTH-cw-MARGINW;
|
||||||
|
cy=4;
|
||||||
|
closebox.setBounds(cx, cy, cw, cw);
|
||||||
|
fixComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fixComponents() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doClose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ZDialogCloseBox extends JEricPanel {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g){
|
||||||
|
// CloseBox is painted in the ZDialog paint method,
|
||||||
|
// because it needs backgound in order to render
|
||||||
|
// the antialisasing of strokes.
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZDialogCloseBox() {
|
||||||
|
setOpaque(false);
|
||||||
|
addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(final MouseEvent e) {
|
||||||
|
if (isCloseBoxVisible()) {
|
||||||
|
doClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(final MouseEvent e) {
|
||||||
|
if (isCloseBoxVisible()) {
|
||||||
|
boxEnter=true;
|
||||||
|
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||||
|
if (zc!=null) {
|
||||||
|
zc.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(final MouseEvent e) {
|
||||||
|
if (isCloseBoxVisible()) {
|
||||||
|
boxEnter=false;
|
||||||
|
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||||
|
if (zc!=null) {
|
||||||
|
zc.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ZDialogTitle extends JLabel {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
if (isTitleVisible()) {
|
||||||
|
super.paint(g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZDialogTitle(String ttle) {
|
||||||
|
super(ttle);
|
||||||
|
setFont(ZTools.ZDialogTitleFont);
|
||||||
|
setForeground(ZTools.TitleTextColor);
|
||||||
|
setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
setOpaque(false);
|
||||||
|
|
||||||
|
addMouseMotionListener(new MouseMotionAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseDragged(MouseEvent arg0) {
|
||||||
|
if (isTitleVisible()) {
|
||||||
|
Point current=MouseInfo.getPointerInfo().getLocation();
|
||||||
|
me.setLocation(winloc.x+current.x-origin.x, winloc.y+current.y-origin.y);
|
||||||
|
/*
|
||||||
|
* the ZDialog window doesn't have to exit the main window
|
||||||
|
*/
|
||||||
|
ZirkelCanvas zc = JZirkelCanvas.getCurrentZC();
|
||||||
|
if(me.getLocation().x+me.getWidth()-NOT_EXIT<=0){
|
||||||
|
me.setLocation(-me.getWidth()+NOT_EXIT, me.getLocation().y);
|
||||||
|
}
|
||||||
|
if(me.getLocation().x+NOT_EXIT>=zc.getWidth()){
|
||||||
|
me.setLocation(zc.getWidth()-NOT_EXIT, me.getLocation().y);
|
||||||
|
}
|
||||||
|
if(me.getLocation().y<=0){
|
||||||
|
me.setLocation(me.getLocation().x, 0);
|
||||||
|
}
|
||||||
|
if(me.getLocation().y+NOT_EXIT>=zc.getHeight()){
|
||||||
|
me.setLocation(me.getLocation().x, zc.getHeight()-NOT_EXIT);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* end of code
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
if (isTitleVisible()) {
|
||||||
|
origin=MouseInfo.getPointerInfo().getLocation();
|
||||||
|
winloc=me.getLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void send(String msg) {
|
||||||
|
}
|
||||||
|
}
|
24
eric/GUI/ZDialog/ZLabel.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZLabel extends JLabel {
|
||||||
|
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZLabel(String s) {
|
||||||
|
super(s);
|
||||||
|
setFont(ZTools.ZLabelFont);
|
||||||
|
}
|
||||||
|
}
|
30
eric/GUI/ZDialog/ZMessageDialog.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import eric.JZirkelCanvas;
|
||||||
|
import rene.zirkel.ZirkelCanvas;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZMessageDialog extends ZDialog {
|
||||||
|
|
||||||
|
public ZMessageDialog() {
|
||||||
|
super("essai", 0, 0, 400, 300, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showMessage() {
|
||||||
|
ZirkelCanvas zc=JZirkelCanvas.getCurrentZC();
|
||||||
|
if (zc!=null) {
|
||||||
|
ZMessageDialog zmd=new ZMessageDialog();
|
||||||
|
zc.add(zmd);
|
||||||
|
zmd.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
45
eric/GUI/ZDialog/ZSep.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import eric.JEricPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZSep extends JEricPanel {
|
||||||
|
|
||||||
|
int percent=100;
|
||||||
|
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
|
||||||
|
Dimension d=getSize();
|
||||||
|
int margin=d.width*(100-percent)/200;
|
||||||
|
g.setColor(ZTools.backTitleColor);
|
||||||
|
g.fillRect(margin, 0, d.width-2*margin, d.height);
|
||||||
|
|
||||||
|
// Dimension d=getSize();
|
||||||
|
// g.setColor(ZTools.B_TextField);
|
||||||
|
// g.fillRect(0, 0, d.width, d.height);
|
||||||
|
// paintChildren(g);
|
||||||
|
// g.setColor(ZTools.Bord_TextField);
|
||||||
|
// g.drawRect(0, 0, d.width, d.height);
|
||||||
|
// if (withback) {
|
||||||
|
// Dimension d=getSize();
|
||||||
|
// g.setColor(ZTools.backTitleColor);
|
||||||
|
// g.fillRect(0, 0, d.width, d.height);
|
||||||
|
// paintChildren(g);
|
||||||
|
// }
|
||||||
|
// super.paintComponent(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZSep(int prop) {
|
||||||
|
super();
|
||||||
|
percent=prop;
|
||||||
|
}
|
||||||
|
}
|
127
eric/GUI/ZDialog/ZTextField.java
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import eric.JEricPanel;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Insets;
|
||||||
|
import java.awt.event.FocusAdapter;
|
||||||
|
import java.awt.event.FocusEvent;
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZTextField extends JEricPanel {
|
||||||
|
JTextField field;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
Dimension d=getSize();
|
||||||
|
g.setColor(ZTools.B_TextField);
|
||||||
|
g.fillRect(0, 0, d.width, d.height);
|
||||||
|
paintChildren(g);
|
||||||
|
g.setColor(ZTools.Bord_TextField);
|
||||||
|
g.drawRect(0, 0, d.width, d.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZTextField(String s) {
|
||||||
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||||
|
setOpaque(false);
|
||||||
|
field=new JTextField(s){
|
||||||
|
@Override
|
||||||
|
public void paintBorder(Graphics g){
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
field.setMargin(new Insets(0, 0, 0, 0));
|
||||||
|
field.setOpaque(false);
|
||||||
|
field.setFont(ZTools.ZTextFieldFont);
|
||||||
|
field.setForeground(ZTools.C_TextField);
|
||||||
|
field.setBackground(ZTools.B_TextField);
|
||||||
|
field.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyReleased(final KeyEvent e) {
|
||||||
|
actionKey(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
field.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {
|
||||||
|
actionMouse();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
field.addFocusListener(new FocusAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusGained(FocusEvent e) {
|
||||||
|
focusOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusLost(FocusEvent e) {
|
||||||
|
focusOff();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
JEricPanel panel=new JEricPanel();
|
||||||
|
Dimension d=new Dimension(1, 1);
|
||||||
|
panel.setOpaque(false);
|
||||||
|
panel.setPreferredSize(d);
|
||||||
|
panel.setMinimumSize(d);
|
||||||
|
panel.setMaximumSize(d);
|
||||||
|
panel.setSize(d);
|
||||||
|
add(panel);
|
||||||
|
add(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionMouse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionKey(KeyEvent k) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void focusOn(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public void focusOff(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditable(boolean b){
|
||||||
|
if (field!=null) {
|
||||||
|
field.setEditable(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHorizontalAlignment(int align){
|
||||||
|
field.setHorizontalAlignment(align);
|
||||||
|
}
|
||||||
|
public String getText(){
|
||||||
|
return field.getText();
|
||||||
|
}
|
||||||
|
public void setText(String s){
|
||||||
|
field.setText(s);
|
||||||
|
}
|
||||||
|
public void selectAll(){
|
||||||
|
field.selectAll();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setForeground(Color c){
|
||||||
|
if (field!=null) {
|
||||||
|
field.setForeground(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
132
eric/GUI/ZDialog/ZTextFieldAndLabel.java
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import eric.JEricPanel;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZTextFieldAndLabel extends JEricPanel {
|
||||||
|
|
||||||
|
private ZTextFieldAndLabel me;
|
||||||
|
private myTextField field=null;
|
||||||
|
private ZLabel label=null;
|
||||||
|
private String InitValue="";
|
||||||
|
private int labelWidth=100;
|
||||||
|
private int labelHeight=20;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g) {
|
||||||
|
paintChildren(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZTextFieldAndLabel(String lbl, String value, int labelwidth,int labelheight) {
|
||||||
|
super();
|
||||||
|
me=this;
|
||||||
|
labelWidth=labelwidth;
|
||||||
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
|
||||||
|
setOpaque(false);
|
||||||
|
if (labelWidth==0) {
|
||||||
|
InitValue="<"+lbl+">";
|
||||||
|
if ("".equals(value)) {
|
||||||
|
add(field=new myTextField(InitValue));
|
||||||
|
field.setForeground(ZTools.C_TextField_OFF);
|
||||||
|
} else {
|
||||||
|
add(field=new myTextField(value));
|
||||||
|
}
|
||||||
|
field.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
add(label=new ZLabel(lbl));
|
||||||
|
add(field=new myTextField(value));
|
||||||
|
ZTools.fixsize(label, labelWidth, labelheight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionMouse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actionKey(java.awt.event.KeyEvent k){
|
||||||
|
}
|
||||||
|
|
||||||
|
public void focusLost(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public void focusGained(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
if (InitValue.equals(field.getText())) {
|
||||||
|
return "";
|
||||||
|
} else {
|
||||||
|
return field.getText();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String txt) {
|
||||||
|
if ("".equals(txt)) {
|
||||||
|
txt=InitValue;
|
||||||
|
field.setForeground(ZTools.C_TextField_OFF);
|
||||||
|
} else {
|
||||||
|
field.setForeground(ZTools.C_TextField);
|
||||||
|
}
|
||||||
|
field.setText(txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setForeground(Color c){
|
||||||
|
if(field!=null){
|
||||||
|
field.setForeground(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditable(boolean b){
|
||||||
|
if (field!=null){
|
||||||
|
field.setEditable(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class myTextField extends ZTextField {
|
||||||
|
|
||||||
|
public myTextField(String s) {
|
||||||
|
super(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionMouse() {
|
||||||
|
me.actionMouse();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionKey(java.awt.event.KeyEvent k){
|
||||||
|
me.actionKey(k);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusOn() {
|
||||||
|
if ((field.getText().equals(InitValue))) {
|
||||||
|
field.setText("");
|
||||||
|
field.setForeground(ZTools.C_TextField);
|
||||||
|
}
|
||||||
|
field.selectAll();
|
||||||
|
me.focusGained();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void focusOff() {
|
||||||
|
if ((field.getText().equals(""))) {
|
||||||
|
field.setText(InitValue);
|
||||||
|
field.setForeground(ZTools.C_TextField_OFF);
|
||||||
|
}
|
||||||
|
me.focusLost();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
eric/GUI/ZDialog/ZTools.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eric.GUI.ZDialog;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import rene.gui.Global;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author erichake
|
||||||
|
*/
|
||||||
|
public class ZTools {
|
||||||
|
public static final Color backMainColor=new Color(100, 100, 100, 50);
|
||||||
|
public static final Color backTitleColor=new Color(0, 0, 0, 200);
|
||||||
|
public static final Color TitleTextColor=new Color(255, 255, 255);
|
||||||
|
public static final Color C_TextField=new Color(50, 50, 50); // Text color of ZTextFields
|
||||||
|
public static final Color C_TextField_OFF=new Color(150, 150, 150); // Disable Text color of ZTextFields
|
||||||
|
public static final Color B_TextField=new Color(245, 246, 255); // ZTextFields background color
|
||||||
|
public static final Color Bord_TextField=new Color(50, 50, 50); // ZTextFields line border color
|
||||||
|
|
||||||
|
public static final Font ZLabelFont=new Font(Global.GlobalFont, 0, 11);
|
||||||
|
public static final Font ZCheckBoxFont=new Font(Global.GlobalFont, 0, 11);
|
||||||
|
public static final Font ZTextFieldFont=new Font(Global.GlobalFont, 0, 11);
|
||||||
|
public static final Font ZDialogTitleFont=new Font(Global.GlobalFont, 1, 12);
|
||||||
|
|
||||||
|
|
||||||
|
public static void fixsize(JComponent jc, int w, int h) {
|
||||||
|
Dimension d=new Dimension(w, h);
|
||||||
|
jc.setSize(d);
|
||||||
|
jc.setMaximumSize(d);
|
||||||
|
jc.setMinimumSize(d);
|
||||||
|
jc.setPreferredSize(d);
|
||||||
|
}
|
||||||
|
}
|
BIN
eric/GUI/icons/.DS_Store
vendored
Normal file
BIN
eric/GUI/icons/bar/aimant.png
Normal file
After Width: | Height: | Size: 863 B |
BIN
eric/GUI/icons/bar/aimantON.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
eric/GUI/icons/bar/angle0.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle1.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle2.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/angle3.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/bold.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
eric/GUI/icons/bar/carbtn.png
Normal file
After Width: | Height: | Size: 700 B |
BIN
eric/GUI/icons/bar/carbtn_dis.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
eric/GUI/icons/bar/cblack.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cblue.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cbrown.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/ccyan.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cgreen.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/chidden.png
Normal file
After Width: | Height: | Size: 612 B |
BIN
eric/GUI/icons/bar/cnormal.png
Normal file
After Width: | Height: | Size: 589 B |
BIN
eric/GUI/icons/bar/cod0.png
Normal file
After Width: | Height: | Size: 228 B |
BIN
eric/GUI/icons/bar/cod1.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
eric/GUI/icons/bar/cod2.png
Normal file
After Width: | Height: | Size: 373 B |
BIN
eric/GUI/icons/bar/cod3.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
eric/GUI/icons/bar/cod4.png
Normal file
After Width: | Height: | Size: 378 B |
BIN
eric/GUI/icons/bar/cod5.png
Normal file
After Width: | Height: | Size: 409 B |
BIN
eric/GUI/icons/bar/cod6.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
eric/GUI/icons/bar/color0.png
Normal file
After Width: | Height: | Size: 633 B |
BIN
eric/GUI/icons/bar/color1.png
Normal file
After Width: | Height: | Size: 658 B |
BIN
eric/GUI/icons/bar/color2.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color3.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color4.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/color5.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
eric/GUI/icons/bar/cred.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
eric/GUI/icons/bar/cshowname.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
eric/GUI/icons/bar/cshowvalue.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
eric/GUI/icons/bar/csolid.png
Normal file
After Width: | Height: | Size: 794 B |
BIN
eric/GUI/icons/bar/csuperhidden.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
eric/GUI/icons/bar/cthick.png
Normal file
After Width: | Height: | Size: 694 B |
BIN
eric/GUI/icons/bar/cthin.png
Normal file
After Width: | Height: | Size: 581 B |
BIN
eric/GUI/icons/bar/filled.png
Normal file
After Width: | Height: | Size: 1007 B |
BIN
eric/GUI/icons/bar/fnct.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
eric/GUI/icons/bar/hide.png
Normal file
After Width: | Height: | Size: 902 B |
BIN
eric/GUI/icons/bar/large.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
eric/GUI/icons/bar/obtuse.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
eric/GUI/icons/bar/open_left.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
eric/GUI/icons/bar/open_right.png
Normal file
After Width: | Height: | Size: 343 B |
BIN
eric/GUI/icons/bar/partial.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
eric/GUI/icons/bar/plines.png
Normal file
After Width: | Height: | Size: 975 B |
BIN
eric/GUI/icons/bar/showname.png
Normal file
After Width: | Height: | Size: 751 B |
BIN
eric/GUI/icons/bar/showvalue.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
eric/GUI/icons/bar/solid.png
Normal file
After Width: | Height: | Size: 1000 B |