Make first real commit: copy of CaRMetal 4.2.8

This commit is contained in:
Glen Whitney 2018-09-04 22:51:42 -04:00
parent 002acfc88e
commit c312811084
1120 changed files with 226843 additions and 1 deletions

0
rene/zirkel/.#Zirkel.java.1.6 Executable file
View file

File diff suppressed because it is too large Load diff

BIN
rene/zirkel/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,87 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel;
import java.awt.event.MouseEvent;
/**
* @author Rene A thread for reporting drags to the main program, avoiding to
* many drag messages, so that the program seems to hang.
*/
class DragThread extends Thread {
MouseEvent EWaiting = null;
ZirkelCanvas ZC;
Object Ready = new Object();
boolean Working = false;
public DragThread(final ZirkelCanvas zc) {
ZC = zc;
start();
}
@Override
public void run() {
MouseEvent e;
while (true) {
if (EWaiting == null) {
try {
synchronized (this) {
wait();
}
} catch (final Exception ex) {
}
}
if (EWaiting != null) {
synchronized (this) {
e = EWaiting;
EWaiting = null;
}
Working = true;
ZC.doMouseDragged(e);
try {
sleep(0);
} catch (final Exception ex) {
}
Working = false;
synchronized (Ready) {
Ready.notify();
}
}
}
}
public synchronized void mouseDragged(final MouseEvent e) {
EWaiting = e;
notify();
}
public void waitReady() {
if (!Working)
return;
synchronized (Ready) {
try {
Thread.currentThread().wait(1000);
} catch (final Exception ex) {
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel;
import java.awt.Image;
import rene.zirkel.macro.Macro;
public interface ZirkelCanvasInterface {
public void replayChosen();
public void runMacro(Macro m);
public boolean enabled(String tool);
public String loadImage();
public Image doLoadImage(String filename);
}

1536
rene/zirkel/ZirkelFrame.java Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
public interface ChangedListener {
public void notifyChanged();
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,442 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.PopupMenu;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.ByteArrayOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Enumeration;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import eric.JEricPanel;
import rene.gui.ButtonAction;
import rene.gui.CheckboxMenuItemAction;
import rene.gui.ChoiceAction;
import rene.gui.DoActionListener;
import rene.gui.Global;
import rene.gui.MenuItemAction;
import rene.lister.Lister;
import rene.lister.ListerMouseEvent;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.objects.AngleObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.ExpressionObject;
import rene.zirkel.objects.FixedAngleObject;
import rene.zirkel.objects.FunctionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PrimitiveCircleObject;
import rene.zirkel.objects.PrimitiveLineObject;
public class ConstructionDisplayPanel extends JEricPanel implements
DoActionListener, ActionListener, ClipboardOwner {
private static final long serialVersionUID=1L;
private static int control_height=25;
private JEricPanel controls;
public Lister V;
public Vector W;
Construction C;
ZirkelCanvas ZC;
JComboBox Ch;
CheckboxMenuItemAction Visible;
boolean ShowVisible=true;
CheckboxMenuItemAction Sort, Description, Size, Formula;
public static String Choices[]={"all", "points", "lines", "circles",
"angles", "expressions", "other"};
public int State=0;
PopupMenu PM;
JButton Menu;
@Override
public void paintComponent(Graphics g) {
Dimension d=getSize();
g.setColor(Color.white);
g.fillRect(0, 0, d.width, d.height);
super.paintComponent(g);
}
public ConstructionDisplayPanel(final ZirkelCanvas zc) {
ZC=zc;
C=ZC.getConstruction();
V=new Lister();
V.setMode(true, false, true, true);
V.addActionListener(this);
State=Global.getParameter("constructiondisplay.state", 0);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setOpaque(false);
controls=new JEricPanel();
controls.setLayout(new BoxLayout(controls, BoxLayout.X_AXIS));
controls.setOpaque(false);
Ch=new ChoiceAction(this, "choices");
for (final String choice : Choices) {
Ch.addItem(Global.name("constructiondisplay."+choice));
}
controls.add(Ch);
Menu=new ButtonAction(this, "?", "Menu");
controls.add(Menu);
add(controls);
setListerState();
makePopup();
add(V);
}
// Only called by LeftPanelContent init method :
public void fixPanelSize(int w, int h) {
fixsize(this, w, h);
fixsize(V, w, h-control_height);
fixsize(controls, w, control_height);
controls.revalidate();
}
private static void fixsize(final JComponent cp, final int w, final int h) {
final Dimension d=new Dimension(w, h);
cp.setMaximumSize(d);
cp.setMinimumSize(d);
cp.setPreferredSize(d);
cp.setSize(d);
}
public void reload() {
V.clear();
C=ZC.getConstruction();
Enumeration e=null;
if (Global.getParameter("constructiondisplay.sort", true)) {
e=C.getSortedElements();
} else {
e=C.elements();
}
W=new Vector();
outer:
while (e.hasMoreElements()) {
final ConstructionObject o=(ConstructionObject) e.nextElement();
// if ((eric.JMacrosTools.CurrentJZF.restrictedSession)
// && (o.isSuperHidden()))
// continue outer;
if (ShowVisible&&o.mustHide(ZC)) {
continue outer;
}
if (ZC.job_isTargets()&&o.isSuperHidden()) {
continue outer;
}
if (ZC.isRestricted()&&o.isSuperHidden()) {
continue outer;
}
switch (State) {
case 0:
break;
case 1:
if (!(o instanceof PointObject)) {
continue outer;
}
break;
case 2:
if (!(o instanceof PrimitiveLineObject)
||(o instanceof FixedAngleObject)) {
continue outer;
}
break;
case 3:
if (!(o instanceof PrimitiveCircleObject)) {
continue outer;
}
break;
case 4:
if (!(o instanceof AngleObject||o instanceof FixedAngleObject)) {
continue outer;
}
break;
case 5:
if (!(o instanceof ExpressionObject||o instanceof FunctionObject)) {
continue outer;
}
break;
case 6:
if (o instanceof PointObject
||o instanceof PrimitiveLineObject
||o instanceof PrimitiveCircleObject
||o instanceof AngleObject
||o instanceof ExpressionObject
||o instanceof FunctionObject) {
continue outer;
}
break;
}
V.addElement(o);
W.addElement(o);
}
//V.showLast();
updateDisplay();
}
public void updateDisplay() {
V.updateDisplay();
}
@Override
public void doAction(final String o) {
if (o.equals("Edit")) {
final int selected[]=V.getSelectedIndices();
if (selected.length==0) {
return;
}
if (selected.length==1) {
((ConstructionObject) W.elementAt(selected[0])).edit(ZC, true, false);
} else {
final Vector v=new Vector();
for (final int element : selected) {
v.addElement(W.elementAt(element));
}
ZC.validate();
}
ZC.repaint();
} else if (o.equals("Copy")) {
try {
final ByteArrayOutputStream ba=new ByteArrayOutputStream(
50000);
final PrintWriter po=new PrintWriter(new OutputStreamWriter(
ba), true);
V.save(po);
po.close();
final String S=ba.toString();
final Clipboard clip=getToolkit().getSystemClipboard();
final StringSelection sel=new StringSelection(S);
clip.setContents(sel, this);
} catch (final Exception e) {
}
} else if (o.equals("Delete")) {
final int selected[]=V.getSelectedIndices();
if (selected.length==0) {
return;
}
final Vector v=new Vector();
for (final int element : selected) {
v.addElement(W.elementAt(element));
}
ZC.delete(v);
ZC.repaint();
ZC.reset();
reload();
} else if (o.equals("Hide")) {
final int selected[]=V.getSelectedIndices();
if (selected.length==0) {
return;
}
for (final int element : selected) {
final ConstructionObject oc=(ConstructionObject) W.elementAt(element);
oc.setHidden(!oc.isHidden());
}
ZC.repaint();
updateDisplay();
} else if (o.equals("SuperHide")) {
final int selected[]=V.getSelectedIndices();
if (selected.length==0) {
return;
}
for (final int element : selected) {
final ConstructionObject oc=(ConstructionObject) W.elementAt(element);
oc.setSuperHidden(true);
}
ZC.repaint();
updateDisplay();
} else if (o.equals("HighLight")) {
final int selected[]=V.getSelectedIndices();
if (selected.length==0) {
return;
}
for (final int element : selected) {
final ConstructionObject oc=(ConstructionObject) W.elementAt(element);
oc.setStrongSelected(true);
}
final Graphics g=ZC.getGraphics();
if (g!=null) {
ZC.paint(g);
g.dispose();
try {
Thread.sleep(200);
} catch (final Exception e) {
}
}
for (final int element : selected) {
final ConstructionObject oc=(ConstructionObject) W.elementAt(element);
oc.setStrongSelected(false);
}
ZC.repaint();
if (selected.length==1) {
final ConstructionObject oc=(ConstructionObject) W.elementAt(selected[0]);
ZC.setConstructionObject(oc);
}
} else if (o.equals("Menu")) {
displayPopup(V.L, 10, 10);
}
ZC.requestFocus();
}
public void itemToggleAction(final String o) {
if (o.equals("Sort")) {
Sort.setState(!Sort.getState());
itemAction("Sort", Sort.getState());
} else if (o.equals("Visible")) {
Visible.setState(!Visible.getState());
itemAction("Visible", Visible.getState());
}
}
@Override
public void itemAction(final String o, final boolean flag) {
if (o.equals("Sort")) {
Global.setParameter("constructiondisplay.sort", Sort.getState());
reload();
} else if (o.equals("Visible")) {
ShowVisible=Visible.getState();
reload();
} else if (o.equals("Description")) {
Global.setParameter("constructiondisplay.listerstate",
ConstructionObject.DescriptionState);
setListerState();
updateDisplay();
} else if (o.equals("Size")) {
Global.setParameter("constructiondisplay.listerstate",
ConstructionObject.SizeState);
setListerState();
updateDisplay();
} else if (o.equals("Formula")) {
Global.setParameter("constructiondisplay.listerstate",
ConstructionObject.FormulaState);
setListerState();
updateDisplay();
} else if (flag) {
State=Ch.getSelectedIndex();
Global.setParameter("constructiondisplay.state", State);
reload();
}
}
public void setListerState() {
final int state=Global.getParameter("constructiondisplay.listerstate",
ConstructionObject.SizeState);
V.setState(state);
if (PM!=null) {
Description.setState(state==ConstructionObject.DescriptionState);
Size.setState(state==ConstructionObject.SizeState);
Formula.setState(state==ConstructionObject.FormulaState);
}
}
// @Override
// public Dimension getPreferredSize() {
// return new Dimension(Global.getParameter(
// "options.constructiondisplay.width", 200), 400);
// }
/**
* React on click events for the construction list
*/
@Override
public void actionPerformed(final ActionEvent e) {
if (e.getSource()==V&&(e instanceof ListerMouseEvent)) {
final ListerMouseEvent em=(ListerMouseEvent) e;
if (em.rightMouse()) {
displayPopup(em.getEvent().getComponent(),
em.getEvent().getX(), em.getEvent().getY());
} else {
if (em.clickCount()>=2) {
doAction("Edit");
} else {
doAction("HighLight");
}
}
}
}
/**
* Display the popup menu. Create it, if necessary.
*
* @param e
* mouse event
*/
public void displayPopup(final Component c, final int x, final int y) {
PM.show(c, x, y);
}
public void makePopup() {
PM=new PopupMenu();
PM.add(new MenuItemAction(this,
Global.name("constructiondisplay.edit"), "Edit"));
PM.addSeparator();
PM.add(new MenuItemAction(this,
Global.name("constructiondisplay.hide"), "Hide"));
PM.add(new MenuItemAction(this, Global.name("constructiondisplay.superhide"), "SuperHide"));
PM.addSeparator();
PM.add(new MenuItemAction(this, Global.name("constructiondisplay.delete"), "Delete"));
PM.addSeparator();
Description=new CheckboxMenuItemAction(this, Global.name("constructiondisplay.description"), "Description");
Description.setState(Global.getParameter(
"constructiondisplay.description", false));
PM.add(Description);
Size=new CheckboxMenuItemAction(this, Global.name("constructiondisplay.size"), "Size");
Description.setState(Global.getParameter("constructiondisplay.size",
true));
PM.add(Size);
Formula=new CheckboxMenuItemAction(this, Global.name("constructiondisplay.formula"), "Formula");
Description.setState(Global.getParameter("constructiondisplay.formula",
false));
PM.add(Formula);
PM.addSeparator();
PM.add(new MenuItemAction(this,
Global.name("constructiondisplay.copy"), "Copy"));
V.L.add(PM);
PM.addSeparator();
Visible=new CheckboxMenuItemAction(this, Global.name("constructiondisplay.visible"), "Visible");
Visible.setState(true);
PM.add(Visible);
Sort=new CheckboxMenuItemAction(this, Global.name("constructiondisplay.sorted"), "Sort");
Sort.setState(Global.getParameter("constructiondisplay.sort", true));
PM.add(Sort);
setListerState();
}
@Override
public void lostOwnership(final Clipboard clipboard,
final Transferable contents) {
}
public void setListingBackground(final Color c) {
V.setListingBackground(c);
}
}

View file

@ -0,0 +1,44 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
public class ConstructionException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
String S;
public ConstructionException(final String s) {
super(s);
S = s;
}
public String getDescription() {
return S;
}
@Override
public String toString() {
return S;
}
}

View file

@ -0,0 +1,83 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
import java.util.Enumeration;
import java.util.Vector;
/**
* This is used to generate unique numbers for construction objects. Instances
* will be static in their classes. There is also an alternative count, which
* can be used for macro generation.
*/
public class Count {
static Vector Counts = new Vector();
int N, BackupN;
boolean Fixed = false;
public Count() {
reset();
Counts.addElement(this);
}
public synchronized int next() {
if (Fixed)
return 0;
N++;
return N;
}
public synchronized void reset() {
N = 0;
}
public synchronized void setAlternate(final boolean flag) {
if (flag) {
BackupN = N;
N = 0;
} else
N = BackupN;
}
static synchronized public void resetAll() {
final Enumeration e = Counts.elements();
while (e.hasMoreElements())
((Count) e.nextElement()).reset();
}
static synchronized public void setAllAlternate(final boolean flag) {
final Enumeration e = Counts.elements();
while (e.hasMoreElements())
((Count) e.nextElement()).setAlternate(flag);
}
public synchronized void fix(final boolean flag) {
Fixed = flag;
}
static synchronized public void fixAll(final boolean flag) {
final Enumeration e = Counts.elements();
while (e.hasMoreElements())
((Count) e.nextElement()).fix(flag);
}
}

View file

@ -0,0 +1,88 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
// file: ConstructionObject.java
import java.util.Enumeration;
import rene.zirkel.objects.ConstructionObject;
public class DepList implements Enumeration {
ConstructionObject E[] = new ConstructionObject[8];
int N = 0, I;
public void reset() {
N = 0;
}
public void add(final ConstructionObject o) {
if (have(o))
return;
if (N < E.length)
E[N++] = o;
else {
final ConstructionObject e[] = new ConstructionObject[E.length + 8];
for (int i = 0; i < E.length; i++)
e[i] = E[i];
E = e;
E[N++] = o;
}
}
public boolean have(final ConstructionObject o) {
for (int i = 0; i < N; i++)
if (E[i] == o)
return true;
return false;
}
public Enumeration elements() {
I = 0;
return this;
}
public boolean hasMoreElements() {
return I < N;
}
public Object nextElement() {
return E[I++];
}
public ConstructionObject[] getArray() {
final ConstructionObject o[] = new ConstructionObject[N];
for (int i = 0; i < N; i++)
o[i] = E[i];
return o;
}
public void translate() {
for (int i = 0; i < N; i++)
E[i] = E[i].getTranslation();
}
public int size() {
return N;
}
}

View file

@ -0,0 +1,811 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
import java.util.Vector;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.ZirkelFrame;
import rene.zirkel.constructors.AngleConstructor;
import rene.zirkel.constructors.AreaConstructor;
import rene.zirkel.constructors.CircleConstructor;
import rene.zirkel.constructors.ExpressionConstructor;
import rene.zirkel.constructors.FunctionConstructor;
import rene.zirkel.constructors.IntersectionConstructor;
import rene.zirkel.constructors.LineConstructor;
import rene.zirkel.constructors.MidpointConstructor;
import rene.zirkel.constructors.ObjectConstructor;
import rene.zirkel.constructors.ParallelConstructor;
import rene.zirkel.constructors.PlumbConstructor;
import rene.zirkel.constructors.PointConstructor;
import rene.zirkel.constructors.QuadricConstructor;
import rene.zirkel.constructors.RayConstructor;
import rene.zirkel.constructors.SegmentConstructor;
import rene.zirkel.macro.Macro;
import rene.zirkel.macro.MacroRunner;
import rene.zirkel.objects.AngleObject;
import rene.zirkel.objects.CircleObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.ExpressionObject;
import rene.zirkel.objects.FixedAngleObject;
import rene.zirkel.objects.FixedCircleObject;
import rene.zirkel.objects.IntersectionObject;
import rene.zirkel.objects.LineObject;
import rene.zirkel.objects.PlumbObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PrimitiveCircleObject;
import rene.zirkel.objects.SegmentObject;
import rene.zirkel.objects.TwoPointLineObject;
public class Interpreter {
Construction C;
public Interpreter(final Construction c) {
C = c;
}
/**
* This is to interpret a single line of input in descriptive mode or a
* single line read from a construction description in a file.
*/
public void interpret(final ZirkelCanvas zc, String s, final String comment)
throws ConstructionException {
boolean Parameter = false, Target = false, Prompt = false;
final Vector V = C.V;
final int VN = V.size(); // note the current construction size
int k;
// Look for special start tags:
if ((k = startTest("parameter", s)) >= 0)
// Parameter objects are set at the end of the function.
{
Parameter = true;
s = s.substring(k).trim();
} else if (s.toLowerCase().equals(Global.name("showall"))
|| s.toLowerCase().equals("showall"))
// This will show all objects even, if there are targets
{
C.ShowAll = true;
return;
} else if (s.toLowerCase().equals(Global.name("invisible"))
|| s.toLowerCase().equals("invisible"))
// This will superhide all objects
{
C.SuperHide = true;
return;
} else if ((k = startTest("target", s)) >= 0)
// Target objects are either set immediate (name only) or
// at the end of the function.
{
Target = true;
s = s.substring(k).trim();
final ConstructionObject o = C.find(s);
// see, if the target ist constructable from the
// parameters, which are already marked cosntructable.
C.determineConstructables();
if (o != null && o.isFlag()) {
o.setTarget(true);
C.addTarget(o);
return;
} else {
Target = true;
}
} else if ((k = startTest("prompt", s)) >= 0) {
Prompt = true;
s = s.substring(k).trim();
if (C.find(s) != null) {
C.PromptFor.addElement(s);
return;
}
}
// Interpret s. First decompose into function and parameters:
String name = "", function = "";
final String params[] = new String[16];
int NParams = 0, n;
if ((n = s.indexOf('=')) >= 0) {
name = s.substring(0, n).trim();
s = s.substring(n + 1).trim();
}
int bracketn = 0;
if (s.startsWith("\"")) {
bracketn = s.indexOf("\"", 1);
}
if (bracketn < 0) {
throw new ConstructionException("exception.brackets");
}
if ((n = s.indexOf('(', bracketn)) >= 0) {
function = s.substring(0, n).trim();
if (function.startsWith("\"") && function.endsWith("\"")
&& function.length() > 1) {
function = function.substring(1, function.length() - 1);
}
s = s.substring(n + 1).trim();
if (!s.endsWith(")")) {
throw new ConstructionException("exception.brackets");
}
final char a[] = s.substring(0, s.length() - 1).toCharArray();
int ia = 0;
int BCount = 0;
while (ia < a.length && NParams < params.length) {
final int ia0 = ia;
while (ia < a.length && (BCount > 0 || a[ia] != ',')) {
if (a[ia] == '\"') {
ia++;
while (ia < a.length && a[ia] != '\"') {
ia++;
}
if (ia >= a.length) {
throw new ConstructionException(Global.name("exception.quotes"));
}
ia++;
} else if (a[ia] == '(') {
BCount++;
ia++;
} else if (a[ia] == ')') {
if (BCount > 0) {
BCount--;
}
else {
throw new ConstructionException(Global.name("exception.brackets"));
}
ia++;
} else {
ia++;
}
}
params[NParams++] = new String(a, ia0, ia - ia0).trim();
ia++;
}
} else {
function = s;
}
final String f = function;
// Interpret special functions:
if (NParams == 3 && ptest(f, "window"))
// window size
{
try {
final double x = new Double(params[0]).doubleValue();
final double y = new Double(params[1]).doubleValue();
final double w = new Double(params[2]).doubleValue();
C.setXYW(x, y, w);
zc.recompute();
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.value"));
}
return;
}
if ((NParams == 1 || NParams == 2) && ptest(f, "color"))
// color for object or default color
{
int i = 0;
for (i = 0; i < ZirkelFrame.ColorStrings.length; i++) {
if (test(params[0], "colors", ZirkelFrame.ColorStrings[i])) {
break;
}
}
if (i < ZirkelFrame.ColorStrings.length) {
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setColor(i);
} else {
C.DefaultColor = i;
}
} else {
throw new ConstructionException(Global.name("exception.color"));
}
return;
}
if ((NParams == 1 || NParams == 2) && ptest(f, "thickness"))
// thickness for objects or default thickness
{
int i;
for (i = 0; i < ZirkelFrame.ColorTypes.length; i++) {
if (test(params[0], "color.type", ZirkelFrame.ColorTypes[i])) {
break;
}
}
if (i < ZirkelFrame.ColorTypes.length) {
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setColorType(i);
} else {
C.DefaultColorType = i;
}
} else {
throw new ConstructionException(Global.name("exception.colortype"));
}
return;
}
if ((NParams == 1 || NParams == 2) && ptest(f, "type"))
// point type for point or default point type
{
int i;
for (i = 0; i < ZirkelFrame.PointTypes.length; i++) {
if (test(params[0], "point.type", ZirkelFrame.PointTypes[i])) {
break;
}
}
if (i < ZirkelFrame.PointTypes.length) {
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null || !(o instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.notfound"));
}
((PointObject) o).setType(i);
} else {
C.DefaultType = i;
}
} else {
throw new ConstructionException(Global.name("exception.type"));
}
return;
}
if ((NParams == 1 || NParams == 2) && ptest(f, "partial"))
// partail view for circle or line or default partial view
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
if (o instanceof PrimitiveCircleObject) {
((PrimitiveCircleObject) o).setPartial(true);
}
if (o instanceof LineObject) {
((LineObject) o).setPartial(true);
}
return;
}
final boolean partial = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
if (o instanceof PrimitiveCircleObject) {
((PrimitiveCircleObject) o).setPartial(partial);
}
if (o instanceof LineObject) {
((LineObject) o).setPartial(partial);
}
} else {
C.Partial = partial;
C.PartialLines = partial;
}
return;
}
if ((NParams == 1 || NParams == 2) && ptest(f, "hide"))
// hide object or toggle show hidden state
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setHidden(true);
return;
}
final boolean hidden = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setHidden(hidden);
} else {
C.Hidden = hidden;
}
return;
}
if (NParams == 2 && ptest(f, "invisible"))
// totally invisible for an object
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setSuperHidden(true);
return;
}
final boolean hidden = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setSuperHidden(hidden);
} else {
throw new ConstructionException(Global.name("exception.notfound"));
}
return;
}
if (NParams >= 1 && ptest(f, "back"))
// push object into background
{
if (NParams == 1) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setBack(true);
return;
}
final boolean back = truetest(params[0]);
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setBack(back);
return;
}
if (NParams >= 1 && ptest(f, "acute"))
// set acute state of angle, or set default acute state
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setObtuse(false);
return;
}
final boolean acute = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setObtuse(!acute);
} else {
C.Obtuse = !acute;
}
return;
}
if (NParams >= 1 && ptest(f, "obtuse"))
// revorse of acute
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setObtuse(false);
return;
}
final boolean obtuse = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setObtuse(obtuse);
} else {
C.Obtuse = obtuse;
}
return;
}
if (NParams >= 1 && ptest(f, "solid"))
// set solid state of object, or default solid state
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setSolid(false);
return;
}
final boolean solid = truetest(params[0]);
if (NParams == 2) {
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setSolid(solid);
} else {
C.Solid = solid;
}
return;
}
if (NParams == 3 && ptest(f, "restrict"))
// set range for circle arcs
{
try {
final PrimitiveCircleObject c = (PrimitiveCircleObject) C.find(params[0]);
c.setRange(params[1], params[2]);
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.notfound"));
}
return;
}
if (NParams >= 1 && ptest(f, "fill"))
// set fill state for objects: fill(o), fill(t/f,o)
{
if (NParams == 1) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setFilled(true);
o.setBack(true);
return;
}
final boolean fill = truetest(params[0]);
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setFilled(fill);
o.setBack(fill);
return;
}
if (NParams >= 1 && ptest(f, "valid"))
// set always valid state of intersection
{
if (NParams == 1) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
if (o instanceof PlumbObject) {
((PlumbObject) o).setRestricted(false);
} else if (o instanceof IntersectionObject) {
((IntersectionObject) o).setRestricted(false);
}
return;
}
truetest(params[0]);
final ConstructionObject o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
if (o instanceof PlumbObject) {
((PlumbObject) o).setRestricted(false);
} else if (o instanceof IntersectionObject) {
((IntersectionObject) o).setRestricted(false);
}
return;
}
if (NParams >= 1 && (ptest(f, "rename") || ptest(f, "name")))
// works like name
{
if (NParams == 1 && !truecheck(params[0])) {
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setShowName(true);
return;
}
ConstructionObject o = C.find(params[0]);
if (o == null) {
final boolean shownames = truetest(params[0]);
if (NParams == 2) {
o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setShowName(truetest(params[0]));
} else {
C.ShowNames = shownames;
}
} else if (!params[1].equals("")) {
o.setName(params[1]);
}
return;
}
if (NParams == 2 && ptest(f, "away"))
// keep interesction away from object
{
final ConstructionObject o = C.find(params[0]);
final ConstructionObject p = C.find(params[1]);
if (!(o instanceof IntersectionObject) || !(p instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.parameter"));
}
((IntersectionObject) o).setAway(p.getName());
return;
}
if (NParams == 2 && ptest(f, "close"))
// keep interesction close to object
{
final ConstructionObject o = C.find(params[0]);
final ConstructionObject p = C.find(params[1]);
if (!(o instanceof IntersectionObject)
|| !(p instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.parameter"));
}
((IntersectionObject) o).setAway(p.getName(), false);
return;
}
if (NParams >= 1 && ptest(f, "value"))
// set the size of an object, value of expression, position of point
// or toggle value display
{
if (NParams == 1 && !truecheck(params[0])) // value(o)
{
final ConstructionObject o = C.find(params[0]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setShowValue(true);
return;
}
ConstructionObject o = C.find(params[0]);
if (o == null) // value(t/f), value(t/f,o)
{
try {
truetest(params[0]);
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.notfound"));
}
if (NParams == 2) {
o = C.find(params[1]);
if (o == null) {
throw new ConstructionException(Global.name("exception.notfound"));
}
o.setShowValue(truetest(params[0]));
} else {
C.ShowValues = true;
}
} else if (NParams == 2) // value(o,x)
{
if (o instanceof SegmentObject) {
final SegmentObject os = (SegmentObject) o;
if (!os.canFix()) {
throw new ConstructionException(Global.name("exception.canfix"));
}
os.setFixed(true, params[1]);
os.validate();
} else if (o instanceof CircleObject) {
final CircleObject os = (CircleObject) o;
if (!os.canFix()) {
throw new ConstructionException(Global.name("exception.canfix"));
}
os.setFixed(true, params[1]);
os.validate();
} else if (o instanceof FixedCircleObject) {
final FixedCircleObject os = (FixedCircleObject) o;
os.setFixed(params[1]);
os.validate();
} else if (o instanceof AngleObject) {
final AngleObject os = (AngleObject) o;
if (!os.canFix()) {
throw new ConstructionException(Global.name("exception.canfix"));
}
os.setFixed(params[1]);
os.validate();
} else if (o instanceof FixedAngleObject) {
final FixedAngleObject os = (FixedAngleObject) o;
os.setFixed(params[1]);
os.validate();
} else if (o instanceof ExpressionObject) {
final ExpressionObject os = (ExpressionObject) o;
os.setFixed(params[1]);
os.validate();
} else {
throw new ConstructionException(Global.name("exception.parameter"));
}
} else if (NParams == 3) // value(P,x,y)
{
if (o instanceof PointObject) {
final PointObject os = (PointObject) o;
if (!os.moveablePoint()) {
throw new ConstructionException(Global.name("exception.canfix"));
}
os.setFixed(params[1], params[2]);
os.validate();
} else {
throw new ConstructionException(Global.name("exception.parameter"));
}
} else {
throw new ConstructionException(Global.name("exception.parameter"));
}
return;
}
// Look for the normal construction functions:
final int i = findFunction(function, zc);
if (i >= 0) {
for (int j = 0; j < NParams; j++) {
params[j] = extend(params[j]);
}
OCs[i].construct(C, name, params, NParams);
// the following are for macro definition in scripts
if (Parameter) {
if (VN >= V.size()) {
throw new ConstructionException(Global.name("exception.macroparameter"));
}
final ConstructionObject o = C.lastButN(0);
o.setMainParameter(true);
if (o.isMainParameter()) {
C.addParameter(o);
C.Prompts.addElement(comment);
} else {
throw new ConstructionException(Global.name("exception.macroparameter"));
}
} else if (Target) {
if (VN + 1 != V.size()) {
throw new ConstructionException(Global.name("exception.macrotarget"));
}
final ConstructionObject o = C.lastButN(0);
o.setTarget(true);
C.addTarget(o);
} else if (Prompt) {
final ConstructionObject o = C.lastButN(0);
C.PromptFor.addElement(o.getName());
}
return;
}
// Finally, look for macros:
final Macro m = zc.chooseMacro(function);
if (m == null) {
throw new ConstructionException(Global.name("exception.function"));
}
MR.setMacro(m, zc);
// System.out.println("nom:"+m.getName());
MR.run(zc, C, name, params, NParams);
// Only for macro definition in scripts
if (Target) {
final ConstructionObject o = C.find(name);
if (o == null) {
throw new ConstructionException(Global.name("exception.macrotarget"));
}
o.setTarget(true);
C.addTarget(o);
} else if (Prompt) {
final ConstructionObject o = C.find(name);
if (o != null) {
C.PromptFor.addElement(o.getName());
}
}
}
public void interpret(final ZirkelCanvas zc, final String s)
throws ConstructionException {
interpret(zc, s, "");
}
static public boolean truetest(String s) throws ConstructionException {
s = s.toLowerCase();
if (s.equals("true") || s.equals(Global.name("true"))) {
return true;
}
if (s.equals("false") || s.equals(Global.name("false"))) {
return false;
}
throw new ConstructionException(Global.name("exception.boolean"));
}
static public boolean truecheck(String s) {
s = s.toLowerCase();
if (s.equals("true") || s.equals(Global.name("true"))) {
return true;
}
if (s.equals("false") || s.equals(Global.name("false"))) {
return true;
}
return false;
}
static public boolean test(final String f, final String tag, final String s) {
return f.equalsIgnoreCase(Global.name(tag + "." + s, ""))
|| f.equals(Global.name(tag + ".short." + s, ""))
|| f.equals(Global.name(tag + "." + s + ".short", ""))
|| f.equalsIgnoreCase(s);
}
static public int startTest(final String tag, final String s) {
int i = startTest0(Global.name(tag, tag).toLowerCase(), s.toLowerCase());
if (i > 0) {
return i;
}
i = startTest0(Global.name(tag + ".short", tag), s);
if (i > 0) {
return i;
}
return startTest0(tag, s.toLowerCase());
}
static public int startTest0(final String tag, final String s) {
if (s.startsWith(tag + " ")) {
return tag.length() + 1;
}
return -1;
}
static public boolean ptest(final String f, final String s) {
return test(f, "function", s);
}
static public boolean nametest(final String f, final String s) {
return test(f, "name", s);
}
/**
* Works like find, but can interpret c(k), p1(s), p2(s) etc.
*/
public String extend(String s) {
if (s.startsWith("c(") && s.endsWith(")")) {
s = s.substring(2, s.length() - 1);
final ConstructionObject o = C.find(s);
if (o instanceof PrimitiveCircleObject) {
return ((PrimitiveCircleObject) o).getP1().getName();
}
} else if (s.startsWith("a(") && s.endsWith(")")) {
s = s.substring(2, s.length() - 1);
final ConstructionObject o = C.find(s);
if (o instanceof TwoPointLineObject) {
return ((TwoPointLineObject) o).getP1().getName();
}
} else if (s.startsWith("b(") && s.endsWith(")")) {
s = s.substring(2, s.length() - 1);
final ConstructionObject o = C.find(s);
if (o instanceof TwoPointLineObject) {
return ((TwoPointLineObject) o).getP2().getName();
}
}
return s;
}
MacroRunner MR = new MacroRunner();
static ObjectConstructor OCs[] = { new PointConstructor(),
new SegmentConstructor(), new LineConstructor(),
new RayConstructor(), new CircleConstructor(),
new IntersectionConstructor(), new ParallelConstructor(),
new PlumbConstructor(), new MidpointConstructor(),
new AngleConstructor(), new AreaConstructor(),
new QuadricConstructor(), new ExpressionConstructor(),
new FunctionConstructor() };
static public String ONs[] = { "point", "segment", "line", "ray", "circle",
"intersection", "parallel", "plumb", "angle", "area",
"quadric", "expression", "function","text" };
static public int findFunction(final String function, final ZirkelCanvas zc) {
for (int i = 0; i < OCs.length; i++) {
if (nametest(function, OCs[i].getTag()) && zc.enabled(ONs[i])) {
return i;
}
}
return -1;
}
}

View file

@ -0,0 +1,29 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.construction;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.objects.ConstructionObject;
public interface Selector {
public boolean isAdmissible(ZirkelCanvas zc, ConstructionObject o);
}

View file

@ -0,0 +1,181 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: QuadricConstructor.java
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.zirkel.Zirkel;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.QuadricObject;
public class QuadricConstructor extends ObjectConstructor {
PointObject P[];
int NPoints;
static PointObject previewPoint = null;
static QuadricObject previewQuadric = null;
public static void deletePreview(final ZirkelCanvas zc) {
if (previewQuadric != null) {
zc.delete(previewQuadric);
previewPoint = null;
previewQuadric = null;
zc.reset();
}
}
private void arrangeP() {
if (NPoints < 5) {
P[4] = previewPoint;
for (int i = 3; i >= NPoints; i--) {
P[i] = P[0];
}
}
}
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual)
return;
if (previewPoint == null)
previewPoint = new PointObject(zc.getConstruction(), "PrevPoint");
if (previewQuadric != null)
previewQuadric.setHidden(true);
final PointObject p = zc.selectCreatePoint(e.getX(), e.getY());
if (previewQuadric != null)
previewQuadric.setHidden(false);
if (p != null) {
P[NPoints++] = p;
p.setSelected(true);
arrangeP();
if (previewQuadric == null) {
previewQuadric = new QuadricObject(zc.getConstruction(), P);
zc.addObject(previewQuadric);
}
previewQuadric.setDefaults();
zc.repaint();
}
showStatus(zc);
if (NPoints == 5) {
final QuadricObject Q = new QuadricObject(zc.getConstruction(), P);
zc.addObject(Q);
Q.setDefaults();
zc.clearSelected();
deletePreview(zc);
}
}
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
if (previewPoint != null) {
previewQuadric.validate();
previewPoint.move(zc.x(e.getX()), zc.y(e.getY()));
zc.repaint();
}
super.mouseMoved(e, zc, simple);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Zirkel.name("message.quadric") + " " + (NPoints + 1));
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P = new PointObject[5];
NPoints = 0;
showStatus(zc);
} else {
zc.setPrompt(Zirkel.name("prompt.quadric"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Quadric"))
return false;
final XmlTag tag = tree.getTag();
for (int i = 0; i < 5; i++)
if (!tag.hasParam("point" + (i + 1)))
throw new ConstructionException("Quadric points missing!");
try {
final PointObject P[] = new PointObject[5];
for (int i = 0; i < 5; i++)
P[i] = (PointObject) c.find(tag.getValue("point" + (i + 1)));
final QuadricObject p = new QuadricObject(c, P);
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Quadric points illegal!");
}
return true;
}
public String getPrompt() {
return Zirkel.name("prompt.quadric");
}
@Override
public String getTag() {
return "Quadric";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 5)
throw new ConstructionException(Zirkel.name("exception.nparams"));
final ConstructionObject P[] = new PointObject[5];
for (int i = 0; i < 5; i++) {
P[i] = c.find(params[i]);
if (P[i] == null)
throw new ConstructionException(Zirkel
.name("exception.notfound")
+ " " + params[i]);
if (!(P[i] instanceof PointObject))
throw new ConstructionException(Zirkel.name("exception.type")
+ " " + params[i]);
}
final QuadricObject s = new QuadricObject(c, (PointObject[]) P);
if (!name.equals(""))
s.setNameCheck(name);
c.add(s);
s.setDefaults();
}
}

BIN
rene/zirkel/constructors/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,448 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: Cicle3Constructor.java
import eric.JSelectPopup;
import java.awt.event.MouseEvent;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.AngleObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.FixedAngleObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
public class AngleConstructor extends ObjectConstructor {
PointObject P1 = null, P2 = null, P3 = null;
boolean Fixed = false;
public AngleConstructor(final boolean fixed) {
Fixed = fixed;
}
public AngleConstructor() {
this(false);
}
FixedAngleObject A;
ConstructionObject O;
boolean ShowsValue, Fix;
int Moved, ex, ey;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc){
if (!zc.Visual)
return;
Fix = e.isShiftDown() || Fixed;
ex = e.getX(); ey = e.getY();
ConstructionObject obj = null;
if(!Fix || !waitForLastPoint()){
obj = select(e.getX(), e.getY(), zc, e.isAltDown());
if(obj!=null){
setConstructionObject(obj, zc);
} else {
Dragging = false;
}
} else { //third clic for a fixed angle, obj=null but whatever
setConstructionObject(obj, zc);
}
}
@Override
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc) {
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(obj instanceof PointonObject)) {
int x=JSelectPopup.getMouseX();
int y=JSelectPopup.getMouseY();
PointObject o=new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), obj);
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
obj=o;
}
if(P1==null){
if(obj instanceof PointObject){
P1=(PointObject) obj;
P1.setSelected(true);
zc.repaint();
}
showStatus(zc);
} else if(P2==null){
if(obj instanceof PointObject){
P2=(PointObject) obj;
P2.setSelected(true);
zc.repaint();
}
showStatus(zc);
} else {
if(!Fix){
if(obj instanceof PointObject){
P3 = (PointObject) obj;
if(P3==P1 || P3==P2){
P3=null;
return;
}
final AngleObject a = new AngleObject(zc.getConstruction(), P1, P2, P3);
zc.addObject(a);
a.setDefaults();
if (P3.moveable() && !P3.isPointOn() && zc.isNewPoint()) {
ShowsValue = a.showValue();
if (Global.getParameter("options.movefixname", true))
a.setShowValue(true);
O = a;
Dragging = true;
a.validate();
zc.repaint();
} else {
Dragging = false;
//P1 = P2 = P3 = null;
reset(zc);
zc.validate();
zc.repaint();
}
}
} else {
final FixedAngleObject a = new FixedAngleObject(zc.getConstruction(), P1, P2, zc.x(ex), zc.y(ey));
zc.addObject(a);
a.setDefaults();
a.init(zc.getConstruction(), zc.x(ex), zc.y(ey));
Moved = 0;
Dragging = true;
ShowsValue = a.showValue();
if (Global.getParameter("options.movefixname", true))
a.setShowValue(true);
O = A = a;
P3 = null;
zc.repaint();
}
}
}
@Override
public boolean waitForLastPoint() {
return P1 != null && P2 != null;
}
@Override
public boolean waitForPoint() {
return !Fixed || (P1 == null || P2 == null);
}
@Override
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
if (!Fixed) {
P3 = select(e.getX(), e.getY(), zc, e.isAltDown());
if (P3 != null) {
final AngleObject a = new AngleObject(zc.getConstruction(), P1,
P2, P3);
zc.addObject(a);
a.setDefaults();
}
zc.repaint();
P3 = null;
} else {
final FixedAngleObject a = new FixedAngleObject(zc
.getConstruction(), P1, P2, zc.x(e.getX()), zc.y(e.getY()));
zc.addObject(a);
a.setDefaults();
a.init(zc.getConstruction(), zc.x(e.getX()), zc.y(e.getY()));
zc.setPreviewObject(a);
zc.repaint();
}
}
@Override
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging)
return;
Moved++;
if (P3 == null) {
A.init(zc.getConstruction(), zc.x(e.getX()), zc.y(e.getY()));
if (A instanceof FixedAngleObject)
((FixedAngleObject) A).setDragable(Moved > 5);
} else {
P3.move(zc.x(e.getX()), zc.y(e.getY()));
zc.validate();
}
zc.repaint();
}
@Override
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging)
return;
Dragging = false;
O.setShowValue(ShowsValue);
zc.repaint();
if (P3 == null) {
zc.clearSelected();
A.round();
if (Moved < 5) {
A.edit(zc, true, true);
if (A instanceof FixedAngleObject
&& ((FixedAngleObject) A).isEditAborted()) {
zc.delete(A);
reset(zc);
return;
}
}
A.validate();
} else
P3.updateText();
reset(zc);
zc.showStatus();
}
public PointObject select(final int x, final int y, final ZirkelCanvas zc, boolean altdown) {
return zc.selectCreatePoint(x, y, altdown);
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P1 = P2 = P3 = null;
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.angle"));
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (Fixed) {
if (P1 == null)
zc.showStatus(Global.name("message.fixedangle.first"));
else if (P2 == null)
zc.showStatus(Global.name("message.fixedangle.root"));
else
zc.showStatus(Global.name("message.fixedangle.second"));
} else {
if (P1 == null)
zc.showStatus(Global.name("message.angle.first"));
else if (P2 == null)
zc.showStatus(Global.name("message.angle.root"));
else
zc.showStatus(Global.name("message.angle.second"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Angle"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("first")) {
final AngleObject o = new AngleObject(c);
try {
if (tag.hasParam("display")) {
final String type = tag.getValue("display");
if (type.equals("small"))
o.setDisplaySize(AngleObject.SMALL);
if (type.equals("normalsize"))
o.setDisplaySize(AngleObject.NORMALSIZE);
if (type.equals("large"))
o.setDisplaySize(AngleObject.LARGE);
if (type.equals("larger"))
o.setDisplaySize(AngleObject.LARGER);
if (type.equals("rectangle"))
o.setDisplaySize(AngleObject.RECT);
}
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
if (tag.hasTrueParam("filled"))
o.setFilled(true);
if (tag.hasParam("fixed"))
o.setFixed(tag.getValue("fixed"));
if (tag.hasTrueParam("acute"))
o.setObtuse(false);
else
o.setObtuse(true);
} catch (final Exception e) {
}
}
if (!tag.hasParam("first") || !tag.hasParam("root"))
throw new ConstructionException("Angle parameters missing!");
if (tag.hasParam("second")) {
try {
final PointObject p1 = (PointObject) c.find(tag
.getValue("first"));
final PointObject p2 = (PointObject) c.find(tag
.getValue("root"));
final PointObject p3 = (PointObject) c.find(tag
.getValue("second"));
final AngleObject o = new AngleObject(c, p1, p2, p3);
if (tag.hasParam("display")) {
final String type = tag.getValue("display");
if (type.equals("small"))
o.setDisplaySize(AngleObject.SMALL);
if (type.equals("large"))
o.setDisplaySize(AngleObject.LARGE);
if (type.equals("larger"))
o.setDisplaySize(AngleObject.LARGER);
if (type.equals("rectangle"))
o.setDisplaySize(AngleObject.RECT);
}
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
if (tag.hasTrueParam("filled"))
o.setFilled(true);
if (tag.hasParam("fixed"))
o.setFixed(tag.getValue("fixed"));
if (tag.hasTrueParam("acute"))
o.setObtuse(false);
else
o.setObtuse(true);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Angle parameters illegal!");
}
} else {
try {
final PointObject p1 = (PointObject) c.find(tag
.getValue("first"));
final PointObject p2 = (PointObject) c.find(tag
.getValue("root"));
final FixedAngleObject o = new FixedAngleObject(c, p1, p2, 0, 0);
if (tag.hasParam("display")) {
final String type = tag.getValue("display");
if (type.equals("small"))
o.setDisplaySize(FixedAngleObject.SMALL);
if (type.equals("large"))
o.setDisplaySize(FixedAngleObject.LARGE);
if (type.equals("larger"))
o.setDisplaySize(FixedAngleObject.LARGER);
if (type.equals("rectangle"))
o.setDisplaySize(FixedAngleObject.RECT);
}
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
if (tag.hasTrueParam("filled"))
o.setFilled(true);
if (tag.hasTrueParam("acute"))
o.setObtuse(false);
else
o.setObtuse(true);
if (tag.hasTrueParam("inverse"))
o.setInverse(true);
else
o.setInverse(false);
if (tag.hasTrueParam("reduced"))
o.setReduced(true);
else
o.setReduced(false);
if (tag.hasTrueParam("dragable"))
o.setDragable(true);
if (tag.hasTrueParam("drawable"))
o.setDragable(true); // downward compatibility
if (tag.hasParam("fixed"))
o.setFixed(tag.getValue("fixed"));
else
throw new ConstructionException("");
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Angle parameters illegal!");
}
}
return true;
}
@Override
public String getTag() {
return "Angle";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 3)
throw new ConstructionException(Global.name("exception.nparams"));
final ConstructionObject P1 = c.find(params[0]);
if (P1 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[0]);
final ConstructionObject P2 = c.find(params[1]);
if (P2 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[1]);
final ConstructionObject P3 = c.find(params[2]);
if (P3 == null || !(P3 instanceof PointObject)) {
final Expression ex = new Expression(params[2], c, null);
if (!ex.isValid())
throw new ConstructionException(Global.name("exception.expression"));
final FixedAngleObject s = new FixedAngleObject(c,
(PointObject) P1, (PointObject) P2, 0, 0);
s.setFixed(params[2]);
if (!name.equals(""))
s.setNameCheck(name);
c.add(s);
s.setDefaults();
s.setObtuse(true);
s.setFixed(params[2]);
s.validate();
return;
}
if (!(P1 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[0]);
if (!(P2 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[1]);
if (!(P3 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[2]);
if (P1 == P2 || P2 == P3)
throw new ConstructionException(Global.name("exception.parameter"));
final AngleObject s = new AngleObject(c, (PointObject) P1,
(PointObject) P2, (PointObject) P3);
if (!name.equals(""))
s.setNameCheck(name);
c.add(s);
s.setDefaults();
}
}

View file

@ -0,0 +1,239 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import eric.JSelectPopup;
import java.awt.event.MouseEvent;
import java.util.Enumeration;
import java.util.Vector;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.AreaObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
public class AreaConstructor extends ObjectConstructor {
AreaObject Polygon=null;
PointObject PreviewPoint=null;
boolean newPoint = false;
public static void deletePreview(final ZirkelCanvas zc) {
zc.reset();
}
public void deletePolygon(ZirkelCanvas zc) {
if (Polygon!=null) {
// Suppression et réinitialisation :
zc.delete(Polygon);
Polygon=null;
zc.clearSelected();
}
}
public void validPolygon(ZirkelCanvas zc) {
if (Polygon!=null) {
Polygon.clearPreviewPoint();
Polygon.setIndicated(false);
zc.update_distant(Polygon, 1);
Polygon=null;
zc.clearSelected();
}
}
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
final PointObject P = zc.selectCreatePoint(e.getX(), e.getY(), e.isAltDown());
newPoint = newPoint || zc.isNewPoint();
setConstructionObject(P, zc);
}
@Override
public void setConstructionObject(ConstructionObject P, ZirkelCanvas zc) {
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(P instanceof PointonObject)) {
int x=JSelectPopup.getMouseX();
int y=JSelectPopup.getMouseY();
PointObject o=new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), P);
newPoint = true;
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
P=o;
}
if (P!=null) {
if (Polygon==null) {
// Création et mise en forme de l'objet polygone :
Polygon=new AreaObject(zc.getConstruction(), new Vector());
zc.addObject(Polygon);
Polygon.setDefaults();
if (!Polygon.isSolid()) {
Polygon.setBack(true);
}
// Création du point preview (sommet n+1) :
PreviewPoint=new PointObject(zc.getConstruction(), "PrevPoint");
PreviewPoint.setXY(P.getX(), P.getY());
Polygon.setPreviewPoint(PreviewPoint);
}
P.setSelected(true);
final Enumeration en=Polygon.V.elements();
while (en.hasMoreElements()) {
// Si on "referme" le polygone en cliquant sur l'un des points existants :
if (en.nextElement()==P) {
// Et si le nombre de sommets est inférieur à 3, cela s'apparente à
// une annulation :
if (Polygon.V.size()<3) {
deletePolygon(zc);
} else {
// Si on a créé un sommet à la volée, il faut réorganiser
// pour éviter un pb de dépendance
if(newPoint){
System.out.println("new point !");
zc.getConstruction().reorderConstruction();
zc.reloadCD();
newPoint = false;
}
validPolygon(zc);
}
// de toutes façons, on quitte :
return;
}
}
Polygon.V.addElement(P);
zc.validate();
zc.repaint();
}
}
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
PointObject p=zc.indicateCreatePoint(e.getX(), e.getY(), false);
if (Polygon!=null) {
if ((p==null)) {
PreviewPoint.move(zc.x(e.getX()), zc.y(e.getY()));
} else {
PreviewPoint.move(p.getX(), p.getY());
}
Polygon.validate();
Polygon.setDefaults();
Polygon.setIndicated(true);
zc.repaint();
}
}
@Override
public String getTag() {
return "Polygon";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams<3) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final Vector v=new Vector();
for (int i=0; i<nparams; i++) {
final ConstructionObject o=c.find(params[i]);
if (o==null) {
throw new ConstructionException(Global.name("exception.notfound")
+" "+params[i]);
}
if (!(o instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")
+" "+params[i]);
}
v.addElement(o);
}
final AreaObject o=new AreaObject(c, v);
if (!name.equals("")) {
o.setNameCheck(name);
}
c.add(o);
o.setDefaults();
o.setBack(true);
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Polygon")) {
return false;
}
final XmlTag tag=tree.getTag();
try {
int i=1;
final Vector v=new Vector();
while (true) {
final PointObject p=(PointObject) c.find(tag.getValue("point"
+i));
if (p==null) {
break;
}
v.addElement(p);
i++;
}
final AreaObject o=new AreaObject(c, v);
o.setBack(true);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
if (tag.hasParam("filled")) {
o.setFilled(false);
}
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Polygon parameters illegal!");
}
return true;
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.area"));
zc.setPrompt("="+Global.name("prompt.area"));
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
deletePolygon(zc);
zc.showStatus(Global.name("message.area"));
}
}

View file

@ -0,0 +1,244 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import java.util.ArrayList;
import java.util.Enumeration;
import java.awt.event.MouseEvent;
import eric.GUI.palette.PaletteManager;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.construction.Selector;
import rene.zirkel.objects.AreaObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.InsideObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
import rene.zirkel.objects.TwoPointLineObject;
public class BoundedPointConstructor extends ObjectConstructor implements
Selector {
boolean Control;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
Control=e.isControlDown();
final ConstructionObject o=zc.selectWithSelector(e.getX(), e.getY(),
this);
if (o==null) {
return;
}
final PointObject p=new PointObject(zc.getConstruction(), zc.x(e.getX()), zc.y(e.getY()), o);
if (!e.isShiftDown()) {
p.setUseAlpha(true);
}
// if (Control && o instanceof InsideObject) p.setInside(true);
if (o instanceof InsideObject) {
p.setInside(true);
}
if (zc.is3D()) { //Dibs : 2D -> 3D.
zc.validate(); //Dibs
if (((PointObject) p).getBound() instanceof AreaObject) {
AreaObject surface= (AreaObject) ((PointObject) p).getBound();
if (((AreaObject)surface).V.size()>2&&((PointObject) surface.V.get(0)).is3D()&&((PointObject) surface.V.get(1)).is3D()&&((PointObject) surface.V.get(2)).is3D()) {
try {
double x0=((PointObject) surface.V.get(0)).getX3D();
double y0=((PointObject) surface.V.get(0)).getY3D();
double z0=((PointObject) surface.V.get(0)).getZ3D();
double x1=((PointObject) surface.V.get(1)).getX3D();
double y1=((PointObject) surface.V.get(1)).getY3D();
double z1=((PointObject) surface.V.get(1)).getZ3D();
double x2=((PointObject) surface.V.get(2)).getX3D();
double y2=((PointObject) surface.V.get(2)).getY3D();
double z2=((PointObject) surface.V.get(2)).getZ3D();
double x_O=zc.getConstruction().find("O").getX();
double x_X=zc.getConstruction().find("X").getX();
double x_Y=zc.getConstruction().find("Y").getX();
double x_Z=zc.getConstruction().find("Z").getX();
double y_O=zc.getConstruction().find("O").getY();
double y_X=zc.getConstruction().find("X").getY();
double y_Y=zc.getConstruction().find("Y").getY();
double y_Z=zc.getConstruction().find("Z").getY();
double coeffa=(x1-x0)*(x_X-x_O)+(y1-y0)*(x_Y-x_O)+(z1-z0)*(x_Z-x_O);
double coeffb=(x2-x0)*(x_X-x_O)+(y2-y0)*(x_Y-x_O)+(z2-z0)*(x_Z-x_O);
double coeffc=(x1-x0)*(y_X-y_O)+(y1-y0)*(y_Y-y_O)+(z1-z0)*(y_Z-y_O);
double coeffd=(x2-x0)*(y_X-y_O)+(y2-y0)*(y_Y-y_O)+(z2-z0)*(y_Z-y_O);
double coeffe=p.getX()-x_O-x0*(x_X-x_O)-y0*(x_Y-x_O)-z0*(x_Z-x_O);
double coefff=p.getY()-y_O-x0*(y_X-y_O)-y0*(y_Y-y_O)-z0*(y_Z-y_O);
double alpha1=(coeffe*coeffd-coefff*coeffb)/(coeffa*coeffd-coeffb*coeffc);
double beta1=(coeffa*coefff-coeffc*coeffe)/(coeffa*coeffd-coeffb*coeffc);
((PointObject) p).setX3D(x0+alpha1*(x1-x0)+beta1*(x2-x0));
((PointObject) p).setY3D(y0+alpha1*(y1-y0)+beta1*(y2-y0));
((PointObject) p).setZ3D(z0+alpha1*(z1-z0)+beta1*(z2-z0));
((PointObject) p).setIs3D(true);
p.validate();
} catch (final Exception eBary) {
}
}
}
}
zc.addObject(p);
p.validate();
p.setDefaults();
}
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
Control=e.isControlDown();
zc.indicateWithSelector(e.getX(), e.getY(), this);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.boundedpoint",
"Bounded Point: Choose a circle or line!"));
}
public boolean isAdmissible(final ZirkelCanvas zc,
final ConstructionObject o) {
// if (Control && o instanceof InsideObject) return true;
// else if (!Control && o instanceof PointonObject) return true;
if (o instanceof InsideObject) {
return true;
}
return false;
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "PointOn")) {
return false;
}
final XmlTag tag=tree.getTag();
if (!tag.hasParam("on")) {
throw new ConstructionException("Point bound missing!");
}
try {
final ConstructionObject o=(ConstructionObject) c.find(tag.getValue("on"));
if (o!=null&&!(o instanceof PointonObject)&&!(o instanceof InsideObject)) {
throw new ConstructionException("");
}
double x=0, y=0;
double x3D=0, y3D=0, z3D=0;
try {
x=new Double(tag.getValue("x")).doubleValue();
y=new Double(tag.getValue("y")).doubleValue();
} catch (final Exception e) {
}
try {
x3D=new Double(tag.getValue("x3D")).doubleValue();
y3D=new Double(tag.getValue("y3D")).doubleValue();
z3D=new Double(tag.getValue("z3D")).doubleValue();
} catch (final Exception e) {
}
PointObject p;
if (o!=null) {
p=new PointObject(c, x, y, o);
} else {
p=new PointObject(c, x, y);
p.setLaterBind(tag.getValue("on"));
}
p.setInside(tag.hasTrueParam("inside"));
try {
final double alpha=new Double(tag.getValue("alpha")).doubleValue();
p.setAlpha(alpha);
p.setUseAlpha(true);
if (tag.hasParam("on")) {
final ConstructionObject on=c.find(tag.getValue("on"));
if (on!=null) {
p.project(on, alpha);
}
}
} catch (final Exception e) {
}
if (tag.hasParam("shape")) {
final String s=tag.getValue("shape");
if (s.equals("square")) {
p.setType(0);
}
if (s.equals("diamond")) {
p.setType(1);
}
if (s.equals("circle")) {
p.setType(2);
}
if (s.equals("dot")) {
p.setType(3);
}
if (s.equals("cross")) {
p.setType(4);
}
if (s.equals("dcross")) {
p.setType(5);
}
}
if (tag.hasParam("boundorder")) {
p.setBoundOrder(Double.valueOf(tag.getValue("boundorder")).doubleValue());
}
if (tag.hasParam("is3D")) {
p.setIs3D(true);
p.move3D(x3D,y3D,z3D);
p.move(c.find("O").getX()+x3D*(c.find("X").getX()-c.find("O").getX())+y3D*(c.find("Y").getX()-c.find("O").getX())+z3D*(c.find("Z").getX()-c.find("O").getX()), c.find("O").getY()+x3D*(c.find("X").getY()-c.find("O").getY())+y3D*(c.find("Y").getY()-c.find("O").getY())+z3D*(c.find("Z").getY()-c.find("O").getY()));
}
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
if (tag.hasParam("fixed")) {
p.setFixed(tag.getValue("x"), tag.getValue("y"));
}
if (tag.hasParam("increment")) {
try {
p.setIncrement(new Double(tag.getValue("increment")).doubleValue());
} catch (final Exception e) {
}
}
} catch (final Exception e) {
e.printStackTrace();
throw new ConstructionException("Illegal point bound!");
}
return true;
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
zc.setPrompt(Global.name("prompt.pointon"));
}
}

View file

@ -0,0 +1,150 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: Cicle3Constructor.java
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.Circle3Object;
import rene.zirkel.objects.PointObject;
public class Circle3Constructor extends ObjectConstructor {
PointObject P1 = null, P2 = null, P3 = null;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual)
return;
if (P1 == null) {
P1 = select(e.getX(), e.getY(), zc, e.isAltDown());
if (P1 != null) {
P1.setSelected(true);
zc.repaint();
}
showStatus(zc);
} else if (P2 == null) {
P2 = select(e.getX(), e.getY(), zc, e.isAltDown());
if (P2 != null && P2 != P1) {
P2.setSelected(true);
zc.repaint();
}
showStatus(zc);
} else {
P3 = select(e.getX(), e.getY(), zc, e.isAltDown());
if (P3 != null) {
final Circle3Object c = new Circle3Object(zc.getConstruction(),
P1, P2, P3);
zc.addObject(c);
c.setDefaults();
c.updateCircleDep();
P1 = P2 = P3 = null;
zc.clearSelected();
showStatus(zc);
}
}
}
@Override
public boolean waitForLastPoint() {
return P1 != null && P2 != null;
}
@Override
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
P3 = select(e.getX(), e.getY(), zc, e.isAltDown());
if (P3 != null) {
final Circle3Object c = new Circle3Object(zc.getConstruction(), P1,
P2, P3);
zc.addObject(c);
c.setDefaults();
zc.validate();
zc.repaint();
P3 = null;
}
}
public PointObject select(final int x, final int y, final ZirkelCanvas zc, boolean altdown) {
return zc.selectCreatePoint(x, y, altdown);
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P1 = P2 = P3 = null;
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.circle3"));
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1 == null)
zc.showStatus(Global.name("message.circle3.first",
"Circle: Choose the first radius point!"));
else if (P2 == null)
zc.showStatus(Global.name("message.circle3.second",
"Circle: Choose the second radius point!"));
else
zc.showStatus(Global.name("message.circle3.midpoint",
"Circle: Choose the midpoint!"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Circle3"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("midpoint") || !tag.hasParam("from")
|| !tag.hasParam("to"))
throw new ConstructionException("Circle3 parameters missing!");
try {
final PointObject p1 = (PointObject) c.find(tag
.getValue("midpoint"));
final PointObject p2 = (PointObject) c.find(tag.getValue("from"));
final PointObject p3 = (PointObject) c.find(tag.getValue("to"));
final Circle3Object o = new Circle3Object(c, p2, p3, p1);
if (tag.hasParam("partial"))
o.setPartial(true);
if (tag.hasParam("start") && tag.hasParam("end"))
o.setRange(tag.getValue("start"), tag.getValue("end"));
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Circle3 parameters illegal!");
}
return true;
}
}

View file

@ -0,0 +1,448 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import eric.JSelectPopup;
import java.awt.event.MouseEvent;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.macro.Macro;
import rene.zirkel.objects.Circle3Object;
import rene.zirkel.objects.CircleObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.FixedCircleObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
import rene.zirkel.objects.PrimitiveCircleObject;
import rene.zirkel.objects.SegmentObject;
public class CircleConstructor extends ObjectConstructor {
PointObject P1=null, P2=null;
boolean Fixed=false;
boolean reallyFixed=false;
int EventX, EventY;
public CircleConstructor(final boolean fixed) {
Fixed=fixed;
}
public CircleConstructor() {
this(false);
}
FixedCircleObject C;
ConstructionObject O;
boolean ShowsValue, ShowsName;
int Moved;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
ConstructionObject obj=null;
reallyFixed=(e.isShiftDown()||Fixed);
EventX=e.getX();
EventY=e.getY();
if ((P1==null)||(!reallyFixed&&(P2==null))){
obj=select(e.getX(), e.getY(), zc, e.isAltDown());
}
setConstructionObject(obj, zc);
}
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc) {
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(obj instanceof PointonObject)) {
int x=JSelectPopup.getMouseX();
int y=JSelectPopup.getMouseY();
PointObject o=new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), obj);
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
obj=o;
}
if (P1==null) {
if (obj instanceof PointObject) {
P1=(PointObject) obj;
P1.setSelected(true);
zc.repaint();
}
} else {
if (reallyFixed) {
final FixedCircleObject c=new FixedCircleObject(zc.getConstruction(), P1, zc.x(EventX), zc.y(EventY));
zc.addObject(c);
c.setDefaults();
zc.repaint();
O=C=c;
ShowsValue=c.showValue();
ShowsName=c.showName();
if (Global.getParameter("options.movefixname", true)) {
C.setShowValue(true);
C.setShowName(true);
}
Dragging=true;
Moved=0;
P2=null;
} else {
if (obj instanceof PointObject) {
P2=(PointObject) obj;
if (P2==P1) {
P2=null;
return;
}
final CircleObject c=new CircleObject(zc.getConstruction(), P1, P2);
zc.addObject(c);
c.setDefaults();
c.validate();
zc.repaint();
if (P2.moveable()&&!P2.isPointOn()&&zc.isNewPoint()) {
ShowsValue=c.showValue();
ShowsName=c.showName();
if (Global.getParameter("options.movename", false)) {
c.setShowValue(true);
c.setShowName(true);
}
O=c;
Dragging=true;
Moved=0;
} else {
P1.setSelected(false);
P1=P2=null;
}
}
}
}
showStatus(zc);
}
@Override
public boolean waitForLastPoint() {
return P1!=null&&P2==null;
}
@Override
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
P2=select(e.getX(), e.getY(), zc, e.isAltDown());
if (P2!=null) {
final CircleObject c=new CircleObject(zc.getConstruction(), P1,
P2);
zc.addObject(c);
c.setDefaults();
c.validate();
zc.repaint();
}
P2=null;
}
@Override
public boolean waitForPoint() {
return P1==null||!Fixed;
}
@Override
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
}
Moved++;
if (P2==null) {
C.init(zc.getConstruction(), zc.x(e.getX()), zc.y(e.getY()));
if (C instanceof FixedCircleObject) {
((FixedCircleObject) C).setDragable(Moved>5);
}
} else {
P2.move(zc.x(e.getX()), zc.y(e.getY()));
zc.validate();
}
zc.repaint();
}
@Override
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
}
Dragging=false;
O.setShowValue(ShowsValue);
O.setShowName(ShowsName);
zc.repaint();
if (P2==null) {
P1.setSelected(false);
P1=null;
C.round();
if (Moved<=5) {
C.edit(zc, true, true);
if (C instanceof FixedCircleObject
&&((FixedCircleObject) C).isEditAborted()) {
zc.delete(C);
zc.repaint();
reset(zc);
}
}
C.validate();
} else {
P1.setSelected(false);
P2.updateText();
P1=P2=null;
}
O.updateCircleDep();
zc.repaint();
zc.showStatus();
}
public PointObject select(final int x, final int y, final ZirkelCanvas zc, boolean altdown) {
return zc.selectCreatePoint(x, y, altdown);
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P1=P2=null;
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.circle"));
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (Fixed) {
if (P1==null) {
zc.showStatus(Global.name("message.fixedcircle.midpoint"));
} else {
zc.showStatus(Global.name("message.fixedcircle.radius"));
}
} else {
if (P1==null) {
zc.showStatus(Global.name("message.circle.midpoint"));
} else {
zc.showStatus(Global.name("message.circle.radius"));
}
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Circle")) {
return false;
}
final XmlTag tag=tree.getTag();
try {
if (!tag.hasParam("midpoint")) {
throw new ConstructionException("Circle parameters missing!");
}
if (!tag.hasParam("through")) {
if (tag.hasParam("fixed")) {
final PointObject p1=(PointObject) c.find(tag.getValue("midpoint"));
final FixedCircleObject o=new FixedCircleObject(c, p1, 0,
0);
c.add(o);
setConditionals(tree, c, o);
setName(tag, o);
set(tree, o);
if (tag.hasParam("partial")) {
o.setPartial(true);
}
if (tag.hasParam("filled")) {
o.setFilled(true);
}
if (tag.hasTrueParam("dragable")) {
o.setDragable(true);
}
if (tag.hasTrueParam("drawable")) {
o.setDragable(true); // downward compatibility
}
o.setFixed(tag.getValue("fixed"));
if (tag.hasParam("start")&&tag.hasParam("end")) {
o.setRange(tag.getValue("start"), tag.getValue("end"));
}
if (tag.hasParam("acute")) {
o.setObtuse(false);
}
if (tag.hasParam("chord")) {
o.setArc(false);
}
} else {
if (!(c instanceof Macro)) {
throw new ConstructionException(
"Circle parameters missing!");
}
final PointObject p1=(PointObject) c.find(tag.getValue("midpoint"));
final PrimitiveCircleObject o=new PrimitiveCircleObject(
c, p1);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
}
} else {
final PointObject p1=(PointObject) c.find(tag.getValue("midpoint"));
final PointObject p2=(PointObject) c.find(tag.getValue("through"));
final CircleObject o=new CircleObject(c, p1, p2);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
if (tag.hasParam("partial")) {
o.setPartial(true);
}
if (tag.hasParam("filled")) {
o.setFilled(true);
}
if (tag.hasParam("start")&&tag.hasParam("end")) {
o.setRange(tag.getValue("start"), tag.getValue("end"));
}
if (tag.hasParam("acute")) {
o.setObtuse(false);
}
if (tag.hasParam("chord")) {
o.setArc(false);
}
if (tag.hasParam("fixed")) {
try {
o.setFixed(true, tag.getValue("fixed"));
} catch (final Exception e) {
throw new ConstructionException("Fixed value illegal!");
}
}
}
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Circle parameters illegal!");
}
return true;
}
@Override
public String getTag() {
return "Circle";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams>3||nparams==0) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject P1=c.find(params[0]);
if (P1==null) {
throw new ConstructionException(Global.name("exception.notfound")
+" "+params[0]);
}
if (!(P1 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "
+params[0]);
}
if (nparams==1) {
final PrimitiveCircleObject s=new PrimitiveCircleObject(c,
(PointObject) P1);
c.add(s);
s.setDefaults();
if (!name.equals("")) {
s.setNameCheck(name);
}
return;
}
final ConstructionObject P2=c.find(params[1]);
if (P2==null) {
final Expression ex=new Expression(params[1], c, null);
if (!ex.isValid()) {
throw new ConstructionException(Global.name("exception.expression"));
}
final FixedCircleObject s=new FixedCircleObject(c,
(PointObject) P1, 0, 0);
c.add(s);
s.setDefaults();
s.setFixed(params[1]);
s.validate();
if (!name.equals("")) {
s.setNameCheck(name);
}
return;
}
if (P2 instanceof SegmentObject) {
final Circle3Object s=new Circle3Object(c, ((SegmentObject) P2).getP1(), ((SegmentObject) P2).getP2(), (PointObject) P1);
c.add(s);
s.setDefaults();
if (!name.equals("")) {
s.setNameCheck(name);
}
return;
}
if (!(P2 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "
+params[1]);
}
if (nparams==3) {
final ConstructionObject P3=c.find(params[2]);
if (P3==null||!(P3 instanceof PointObject)) {
final CircleObject s=new CircleObject(c, (PointObject) P1,
(PointObject) P2);
if (!s.canFix()) {
throw new ConstructionException(Global.name("exception.canfix"));
}
s.setFixed(true, params[2]);
if (!s.isValidFix()) {
throw new ConstructionException(Global.name("exception.fix")
+" "+params[2]);
}
c.add(s);
s.validate();
if (!name.equals("")) {
s.setNameCheck(name);
}
s.setDefaults();
return;
} else {
final Circle3Object cr=new Circle3Object(c, (PointObject) P2,
(PointObject) P3, (PointObject) P1);
c.add(cr);
cr.setDefaults();
if (!name.equals("")) {
cr.setNameCheck(name);
}
return;
}
}
final CircleObject s=new CircleObject(c, (PointObject) P1,
(PointObject) P2);
c.add(s);
s.setDefaults();
if (!name.equals("")) {
s.setName(name);
}
}
}

View file

@ -0,0 +1,57 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.EquationXYObject;
/**
*
* @author erichake
*/
public class EquationXYConstructor extends ObjectConstructor {
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "EqXY")) {
return false;
}
final XmlTag tag = tree.getTag();
if (tag.hasParam("f")) // function
{
final EquationXYObject eq = new EquationXYObject(c, tag
.getValue("f"), Integer.parseInt(tag.getValue("Dhor")));
eq.setName(tag.getValue("name"));
// eq.setDefaults();
set(tree, eq);
c.add(eq);
eq.updateText();
setConditionals(tree,c,eq);
}
return true;
}
}

View file

@ -0,0 +1,155 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.ExpressionObject;
public class ExpressionConstructor extends ObjectConstructor {
ExpressionObject O;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
final double x = zc.x(e.getX()), y = zc.y(e.getY());
final ExpressionObject o = new ExpressionObject(zc.getConstruction(),
x, y);
zc.addObject(o);
o.setShowName(false);
o.setDefaults();
zc.repaint();
Dragging = true;
O = o;
}
@Override
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging)
return;
O.move(zc.x(e.getX()), zc.y(e.getY()));
zc.repaint();
}
@Override
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging)
return;
Dragging = false;
O.edit(zc, true, true);
}
@Override
public boolean waitForPoint() {
return false;
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.expression",
"Expression: Choose a place!"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Expression"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("x") || !tag.hasParam("y"))
throw new ConstructionException("Expression coordinates missing!");
if (!tag.hasParam("value"))
throw new ConstructionException(Global.name("exception.expression"));
final ExpressionObject p = new ExpressionObject(c, 0, 0);
double x, y;
try {
x = new Expression(tag.getValue("x"), c, p).getValue();
y = new Expression(tag.getValue("y"), c, p).getValue();
p.move(x, y);
} catch (final Exception e) {
}
p.setDefaults();
if (tag.hasParam("prompt"))
p.setPrompt(tag.getValue("prompt"));
if (tag.hasParam("fixed")) {
p.setFixed(tag.getValue("x"), tag.getValue("y"));
}
p.setShowValue(tag.hasParam("showvalue"));
setName(tag, p);
set(tree, p);
c.add(p);
try {
p.setExpression(tag.getValue("value"), c);
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.expression"));
}
setConditionals(tree, c, p);
if (tag.hasTrueParam("slider")) {
try {
p.setSlider(tag.getValue("min"), tag.getValue("max"));
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.expression"));
}
}
return true;
}
@Override
public String getTag() {
return "Expression";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams == 1) {
final ExpressionObject o = new ExpressionObject(c, c.getX()
+ (Math.random() - 0.5) * c.getW(), c.getY()
+ (Math.random() - 0.5) * c.getW());
if (!name.equals(""))
o.setNameCheck(name);
c.add(o);
o.setDefaults();
try {
o.setExpression(params[0], c);
} catch (final Exception e) {
throw new ConstructionException(Global.name("exception.expression"));
}
} else
throw new ConstructionException(Global.name("exception.nparams"));
}
@Override
public boolean useSmartBoard() {
return false;
}
}

View file

@ -0,0 +1,174 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.FunctionObject;
import rene.zirkel.objects.UserFunctionObject;
public class FunctionConstructor extends ObjectConstructor {
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Function")) {
return false;
}
final XmlTag tag = tree.getTag();
if (tag.hasParam("f")) {// function
if (!tag.hasParam("var")) {
throw new ConstructionException("Function invalid!");
}
try {
final String y = tag.getValue("f");
final String var = tag.getValue("var");
final UserFunctionObject f = new UserFunctionObject(c);
f.setDefaults();
setName(tag, f);
set(tree, f);
c.add(f);
double xpos, ypos;
try {
if (tag.hasParam("fixed")) {
f.setFixed(tag.getValue("x"), tag.getValue("y"));
} else {
xpos = new Expression(tag.getValue("x"), c, f)
.getValue();
ypos = new Expression(tag.getValue("y"), c, f)
.getValue();
f.move(xpos, ypos);
}
} catch (final Exception e) {
}
if (tag.hasParam("filled")) {
f.setFilled(true);
}
f.setExpressions(var, y);
setConditionals(tree, c, f);
f.updateText();
return true;
} catch (final Exception e) {
throw new ConstructionException("Function invalid!");
}
} else { // curve
if (!tag.hasParam("min") && !tag.hasParam("max")
&& !tag.hasParam("d") && !tag.hasParam("var")
&& !tag.hasParam("x") && !tag.hasParam("y")) {
throw new ConstructionException("Function invalid!");
}
try {
final String x = tag.getValue("x");
final String y = tag.getValue("y");
final String var = tag.getValue("var");
final String d = tag.getValue("d");
final String min = tag.getValue("min");
final String max = tag.getValue("max");
final FunctionObject f = new FunctionObject(c);
f.setDefaults();
setType(tag, f);
setName(tag, f);
set(tree, f);
c.add(f);
if (tag.hasParam("filled")) {
f.setFilled(true);
} else {
f.setFilled(false);
}
f.setExpressions(var, x, y);
f.setRange(min, max, d);
f.setSpecial(tag.hasTrueParam("special"));
if(tag.hasParam("minbound")) {
f.setMinOpen(tag.getValue("minbound").equals("0"));
f.setMinClosed(tag.getValue("minbound").equals("1"));
}
if(tag.hasParam("maxbound")) {
f.setMaxOpen(tag.getValue("maxbound").equals("0"));
f.setMaxClosed(tag.getValue("maxbound").equals("1"));
}
setConditionals(tree, c, f);
if (tag.hasParam("center")) {
f.setCenter(tag.getValue("center"));
}
f.updateText();
return true;
} catch (final Exception e) {
throw new ConstructionException("Function invalid!");
}
}
}
static public void setType(final XmlTag tag, final FunctionObject p) {
if (tag.hasParam("shape")) {
final String s = tag.getValue("shape");
if (s.equals("square"))
p.setType(0);
if (s.equals("diamond"))
p.setType(1);
if (s.equals("circle"))
p.setType(2);
if (s.equals("dot"))
p.setType(3);
if (s.equals("cross"))
p.setType(4);
if (s.equals("dcross"))
p.setType(5);
}
}
@Override
public String getTag() {
return "Function";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 6)
throw new ConstructionException(Global.name("exception.nparams"));
boolean added = false;
try {
final FunctionObject F = new FunctionObject(c);
c.add(F);
added = true;
if (!name.equals(""))
F.setNameCheck(name);
F.setRange(params[0], params[1], params[2]);
F.setExpressions(params[3], params[4], params[5]);
F.setDefaults();
} catch (final ConstructionException e) {
if (added)
c.back();
throw e;
} catch (final Exception e) {
if (added)
c.back();
throw new ConstructionException("Function Invalid!");
}
}
}

View file

@ -0,0 +1,140 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
import eric.JZirkelCanvas;
import eric.Media;
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.ImageObject;
import rene.zirkel.objects.PointObject;
public class ImageConstructor extends ObjectConstructor {
PointObject P[];
int NPoints;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual)
return;
final PointObject p = zc.selectCreatePoint(e.getX(), e.getY(), e.isAltDown());
if (p != null) {
P[NPoints++] = p;
p.setSelected(true);
zc.repaint();
}
showStatus(zc);
if (NPoints == 3) {
final String filename = zc.loadImage();
if (filename.equals("")) {
reset(zc);
return;
}
Media.createMedia(filename);
final ImageObject o = new ImageObject(zc.getConstruction(), P,
filename);
zc.addObject(o);
zc.clearSelected();
reset(zc);
zc.repaint();
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (NPoints <= 1)
zc.showStatus(ConstructionObject.text1(
Global.name("message.image"), "" + (NPoints + 1)));
else
zc.showStatus(Global.name("message.image.last"));
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P = new PointObject[3];
NPoints = 0;
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.image"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Image"))
return false;
final XmlTag tag = tree.getTag();
for (int i = 0; i < 3; i++)
if (!tag.hasParam("point" + (i + 1)))
throw new ConstructionException("Image points missing!");
if (!tag.hasParam("filename"))
throw new ConstructionException("Image filename missing!");
try {
final PointObject P[] = new PointObject[3];
for (int i = 0; i < 3; i++)
P[i] = (PointObject) c.find(tag.getValue("point" + (i + 1)));
final String filename = JZirkelCanvas.getFilePath(c)+tag.getValue("filename");
Media.createMedia(filename);
final ImageObject p = new ImageObject(c, P, filename);
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Image points illegal!");
}
return true;
}
public String getPrompt() {
return Global.name("prompt.image");
}
@Override
public String getTag() {
return "Image";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
}
}

View file

@ -0,0 +1,468 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
import java.awt.event.MouseEvent;
import eric.JZirkelCanvas;
import rene.util.MyVector;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.CircleIntersectionObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.IntersectionObject;
import rene.zirkel.objects.LineCircleIntersectionObject;
import rene.zirkel.objects.LineIntersectionObject;
import rene.zirkel.objects.LineQuadricIntersectionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObjectIntersectionObject;
import rene.zirkel.objects.PrimitiveCircleObject;
import rene.zirkel.objects.PrimitiveLineObject;
import rene.zirkel.objects.QuadricObject;
import rene.zirkel.objects.QuadricQuadricIntersectionObject;
public class IntersectionConstructor extends ObjectConstructor {
ConstructionObject P1=null, P2=null;
boolean immediate = false;
MouseEvent ev = null;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
ev = e;
if (P1==null) {
final MyVector v=zc.selectPointonObjects(e.getX(), e.getY());
if (v.size()==2) {
P1=(ConstructionObject) v.elementAt(0);
P2=(ConstructionObject) v.elementAt(1);
if (P1.equals(P2)|| P2.equals(P1) || (P1.isFilled()&&P2.isFilled())) {
P1=P2=null;
} else {
immediate=true;
}
}
}
ConstructionObject obj = null;
if(P1==null || P2==null){
obj = select(e.getX(), e.getY(), zc);
}
setConstructionObject(obj, zc);
}
@Override
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc){
if (P1==null) {
P1 = obj;
if (P1!=null) {
P1.setSelected(true);
zc.repaint();
showStatus(zc);
}
} else if(P2==null) {
P2 = obj;
}
if (P2!=null) {
if (P2==P1) {
P2=null;
return;
}
final IntersectionObject o[]=construct(P1, P2, zc.getConstruction());
if (o!=null) {
IntersectionObject oc=null;
if (immediate&&o.length>1) {
if (o[1].nearto(ev.getX(), ev.getY(), zc)) {
o[0]=null;
oc=o[1];
} else {
o[1]=null;
oc=o[0];
}
}
for (final IntersectionObject element : o) {
if (element!=null) {
element.setDefaults();
zc.addObject(element);
element.validate(zc.x(ev.getX()), zc.y(ev.getY()));
}
}
/**
* See, if the other intersection is visible and already a
* point of both objects.
*/
if (oc!=null) {
oc.autoAway();
}
}
reset(zc);
}
}
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
// System.out.println("inter : "+e.getX()+" "+e.getY());
zc.indicateIntersectedObjects(e.getX(), e.getY());
}
public static IntersectionObject[] construct(final ConstructionObject P1,
final ConstructionObject P2, final Construction c) {
IntersectionObject o[]=null;
if (P1 instanceof PrimitiveLineObject) {
if (P2 instanceof PrimitiveLineObject) {
o=new IntersectionObject[1];
o[0]=new LineIntersectionObject(c, (PrimitiveLineObject) P1,
(PrimitiveLineObject) P2);
} else if (P2 instanceof PrimitiveCircleObject) {
o=new IntersectionObject[2];
o[0]=new LineCircleIntersectionObject(c,
(PrimitiveLineObject) P1, (PrimitiveCircleObject) P2,
true);
o[1]=new LineCircleIntersectionObject(c,
(PrimitiveLineObject) P1, (PrimitiveCircleObject) P2,
false);
} else if (P2 instanceof QuadricObject) {
o=new IntersectionObject[2];
o[0]=new LineQuadricIntersectionObject(c,
(PrimitiveLineObject) P1, (QuadricObject) P2, true);
o[1]=new LineQuadricIntersectionObject(c,
(PrimitiveLineObject) P1, (QuadricObject) P2, false);
} else {
return construct(P2, P1, c);
}
} else if (P1 instanceof QuadricObject) {
if (P2 instanceof PrimitiveLineObject) {
o=new IntersectionObject[2];
o[0]=new LineQuadricIntersectionObject(c,
(PrimitiveLineObject) P2, (QuadricObject) P1, true);
o[1]=new LineQuadricIntersectionObject(c,
(PrimitiveLineObject) P2, (QuadricObject) P1, false);
} else if (P2 instanceof QuadricObject) {
if (((QuadricObject) P1).getP()[0].is3D()||((QuadricObject) P1).getP()[1].is3D()||((QuadricObject) P1).getP()[2].is3D()||((QuadricObject) P1).getP()[3].is3D()||((QuadricObject) P1).getP()[4].is3D()||
((QuadricObject) P2).getP()[0].is3D()||((QuadricObject) P2).getP()[1].is3D()||((QuadricObject) P2).getP()[2].is3D()||((QuadricObject) P2).getP()[3].is3D()||((QuadricObject) P2).getP()[4].is3D()) {// Dibs : truc de givré pour régler un bug avec l'intersection de cercles 3D
final PointObject p1=((QuadricObject) P1).getP()[1];
p1.setEX3D(p1.getEX3D().toString()+"+0.00001");
p1.setFixed("x(O)+("+p1.getEX3D()+")*(x(X)-x(O))+("+p1.getEY3D()+")*(x(Y)-x(O))+("+p1.getEZ3D()+")*(x(Z)-x(O))", "y(O)+("+p1.getEX3D()+")*(y(X)-y(O))+("+p1.getEY3D()+")*(y(Y)-y(O))+("+p1.getEZ3D()+")*(y(Z)-y(O))");
}
o=new IntersectionObject[4];
o[0]=new QuadricQuadricIntersectionObject(c,
(QuadricObject) P2, (QuadricObject) P1, 0);
o[1]=new QuadricQuadricIntersectionObject(c,
(QuadricObject) P2, (QuadricObject) P1, 1);
o[2]=new QuadricQuadricIntersectionObject(c,
(QuadricObject) P2, (QuadricObject) P1, 2);
o[3]=new QuadricQuadricIntersectionObject(c,
(QuadricObject) P2, (QuadricObject) P1, 3);
} else {
o=new PointonObjectIntersectionObject[1];
o[0]=new PointonObjectIntersectionObject(c, P1, P2);
}
} else if (P1 instanceof PrimitiveCircleObject) {
if (P2 instanceof PrimitiveCircleObject) {
if ((P1.isDPLineOrSegmentObject())&&(P2.isDPLineOrSegmentObject())) {
o=new IntersectionObject[1];
o[0]=new CircleIntersectionObject(c,
(PrimitiveCircleObject) P1, (PrimitiveCircleObject) P2,
true);
} else {
o=new IntersectionObject[2];
o[0]=new CircleIntersectionObject(c,
(PrimitiveCircleObject) P1, (PrimitiveCircleObject) P2,
true);
o[1]=new CircleIntersectionObject(c,
(PrimitiveCircleObject) P1, (PrimitiveCircleObject) P2,
false);
}
} else if (P2 instanceof PrimitiveLineObject) {
o=new IntersectionObject[2];
o[0]=new LineCircleIntersectionObject(c,
(PrimitiveLineObject) P2, (PrimitiveCircleObject) P1,
true);
o[1]=new LineCircleIntersectionObject(c,
(PrimitiveLineObject) P2, (PrimitiveCircleObject) P1,
false);
} else {
return construct(P2, P1, c);
}
} else {
o=new PointonObjectIntersectionObject[1];
o[0]=new PointonObjectIntersectionObject(c, P1, P2);
}
return o;
}
public ConstructionObject select(final int x, final int y, final ZirkelCanvas zc) // select a line or circle at x,y
{
return zc.selectPointonObject(x, y, false);
}
@Override
public void reset(final ZirkelCanvas zc) { // reset the tool
super.reset(zc);
if (zc.Visual) {
P1=P2=null;
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.intersection"));
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1==null) {
zc.showStatus(Global.name("message.intersection.first",
"Intersection: Select first object!"));
} else {
zc.showStatus(Global.name("message.intersection.second",
"Intersection: Select second object!"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Intersection")) {
return constructOther(tree, c);
}
final XmlTag tag=tree.getTag();
if (!tag.hasParam("first")||!tag.hasParam("second")) {
throw new ConstructionException("Intersection parameters missing!");
}
try {
final ConstructionObject o1=c.find(tag.getValue("first"));
final ConstructionObject o2=c.find(tag.getValue("second"));
final IntersectionObject o[]=construct(o1, o2, c);
if (o==null) {
throw new Exception("");
}
String name="", nameOther="";
if (tag.hasParam("name")) {
name=tag.getValue("name");
}
if (tag.hasParam("other")) {
nameOther=tag.getValue("other");
}
if (o.length>1) {
IntersectionObject oo=o[0];
if (tag.hasParam("which")) {
if (tag.getValue("which").equals("first")) {
oo=o[0];
} else if (tag.getValue("which").equals("second")) {
oo=o[1];
} else if (tag.getValue("which").equals("0")) {
oo=o[0];
} else if (tag.getValue("which").equals("1")) {
oo=o[1];
} else if (tag.getValue("which").equals("2")) {
oo=o[2];
} else if (tag.getValue("which").equals("3")) {
oo=o[3];
}
if (!name.equals("")) {
oo.setName(name);
}
PointConstructor.setType(tag, oo);
setName(tag, oo);
set(tree, oo);
c.add(oo);
setConditionals(tree, c, oo);
if (tag.hasParam("awayfrom")) {
oo.setAway(tag.getValue("awayfrom"), true);
} else if (tag.hasParam("closeto")) {
oo.setAway(tag.getValue("closeto"), false);
}
if (tag.hasParam("valid")) {
oo.setRestricted(false);
}
if (tag.hasParam("alternate")) {
oo.setAlternate(true);
}
} else if (tag.hasParam("other")) {
if (!name.equals("")) {
o[0].setName(name);
}
if (!nameOther.equals("")) {
o[1].setName(nameOther);
}
if (tag.hasParam("awayfrom")) {
o[0].setAway(tag.getValue("awayfrom"), true);
o[1].setAway(tag.getValue("awayfrom"), false);
} else if (tag.hasParam("closeto")) {
o[1].setAway(tag.getValue("awayfrom"), true);
o[0].setAway(tag.getValue("awayfrom"), false);
}
for (final IntersectionObject element : o) {
if (element==null) {
continue;
}
PointConstructor.setType(tag, element);
set(tree, element);
c.add(element);
setConditionals(tree, c, element);
}
}
} else {
if (!name.equals("")) {
o[0].setName(name);
}
PointConstructor.setType(tag, o[0]);
setName(tag, o[0]);
set(tree, o[0]);
c.add(o[0]);
setConditionals(tree, c, o[0]);
if (tag.hasParam("valid")) {
o[0].setRestricted(false);
}
try {
final double x=new Double(tag.getValue("x")).doubleValue();
final double y=new Double(tag.getValue("y")).doubleValue();
o[0].setXY(x, y);
} catch (final Exception e) {
}
}
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
//e.printStackTrace();
throw new ConstructionException("Intersection parameters illegal!");
}
return true;
}
public boolean constructOther(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "OtherIntersection")) {
return false;
}
final XmlTag tag=tree.getTag();
if (tag.hasParam("name")) {
final ConstructionObject o=c.find(tag.getValue("name"));
if (o==null||!(o instanceof IntersectionObject)) {
throw new ConstructionException("OtherIntersection not found!");
}
final IntersectionObject oo=(IntersectionObject) o;
PointConstructor.setType(tag, oo);
o.setDefaults();
set(tree, o);
final ConstructionObject ol=c.lastButN(1);
if (tag.hasParam("awayfrom")) {
oo.setAway(tag.getValue("awayfrom"), true);
if (ol!=null&&(ol instanceof IntersectionObject)) {
((IntersectionObject) ol).setAway(tag.getValue("awayfrom"),
false);
}
} else if (tag.hasParam("closeto")) {
oo.setAway(tag.getValue("closeto"), false);
if (ol!=null&&(ol instanceof IntersectionObject)) {
((IntersectionObject) ol).setAway(tag.getValue("awayfrom"),
true);
}
}
if (tag.hasParam("valid")) {
oo.setRestricted(false);
}
} else {
throw new ConstructionException(
"OtherIntersection must have a name!");
}
return true;
}
@Override
public String getTag() {
return "Intersection";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams!=2&&nparams!=3) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject p1=c.find(params[0]);
if (p1==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[0]);
}
final ConstructionObject p2=c.find(params[1]);
if (p2==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[0]);
}
final IntersectionObject o[]=construct(p1, p2, c);
if (o==null) {
throw new ConstructionException(Global.name("exception.type"));
}
if (o.length==1) {
c.add(o[0]);
o[0].setDefaults();
if (!name.equals("")) {
o[0].setName(name);
}
} else {
if (name.equals("")) {
for (final IntersectionObject element : o) {
c.add(element);
element.setDefaults();
}
} else {
final String names[]=new String[2];
int n;
if ((n=name.indexOf(','))>=0) {
names[0]=name.substring(n+1).trim();
names[1]=name.substring(0, n).trim();
} else {
names[0]=name;
names[1]="";
}
for (int i=0; i<o.length; i++) {
if (names[i].equals("")) {
continue;
}
c.add(o[i]);
o[i].setDefaults();
o[i].setName(names[i]);
}
}
}
}
}

View file

@ -0,0 +1,319 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: LineConstructor.java
import eric.JSelectPopup;
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.macro.Macro;
import rene.zirkel.objects.AxisObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.LineObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
import rene.zirkel.objects.PrimitiveLineObject;
public class LineConstructor extends ObjectConstructor {
PointObject P1=null, P2=null;
ConstructionObject O;
boolean Fix=false;
boolean ShowsValue, ShowsName, Moved;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
Fix=e.isShiftDown()||isFixed();
ConstructionObject obj;
if (Fix&&P1!=null&&!Dragging) { //Dibs, modif pour le segment de longueur fixe
obj= new PointObject(zc.getConstruction(),zc.x(e.getX()), zc.y(e.getY()));
((PointObject) obj).setUseAlpha(true);
zc.addObject(obj);
zc.validate();
obj.setDefaults();
zc.repaint();
obj.edit(zc, false, false);
zc.setNewPoint(true);
}
else {
obj=select(e.getX(), e.getY(), zc, e.isAltDown());
}
if (obj!=null) {
setConstructionObject(obj, zc);
} else {
Dragging=false;
}
}
@Override
public boolean waitForLastPoint() {
return P1!=null&&P2==null;
}
@Override
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc) {
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(obj instanceof PointonObject)) {
int x=JSelectPopup.getMouseX();
int y=JSelectPopup.getMouseY();
PointObject o=new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), obj);
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
obj=o;
}
if (P1==null) {
if (obj instanceof PointObject) {
// System.out.println("premier point="+obj.getName());
P1=(PointObject) obj;
P1.setSelected(true);
zc.repaint();
}
} else if (P2==null) {
if (obj instanceof PointObject) {
// System.out.println("deuxième point="+obj.getName());
P2=(PointObject) obj;
if (P2==P1) {
P2=null;
return;
}
final ConstructionObject o=create(zc.getConstruction(), P1,P2);
zc.addObject(o);
o.setDefaults();
if (P2.moveable()&&!P2.isPointOn()&&zc.isNewPoint()) {
Dragging=true;
Moved=false;
O=o;
ShowsValue=o.showValue();
ShowsName=o.showName();
if ((Fix&&Global.getParameter("options.movefixname", true))||(!Fix&&Global.getParameter("options.movename",
false))) {
o.setShowValue(true);
o.setShowName(true);
}
} else {
Dragging=false;
if (Fix) {
setFixed(zc, o);
}
P1=P2=null;
}
zc.clearSelected();
}
}
showStatus(zc);
}
@Override
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
P2=select(e.getX(), e.getY(), zc, e.isAltDown());
if (P2!=null) {
final ConstructionObject o=create(zc.getConstruction(), P1, P2);
zc.addObject(o);
o.setDefaults();
zc.validate();
zc.repaint();
P2=null;
}
}
@Override
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
};
Moved=true;
if (P2!=null) {
P2.move(zc.x(e.getX()), zc.y(e.getY()));
zc.validate();
zc.repaint();
}
}
@Override
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
}
Dragging=false;
O.setShowValue(ShowsValue);
O.setShowName(ShowsName);
if (Fix) {
O.round();
}
zc.repaint();
if (Fix&&!Moved) {
setFixed(zc, O);
} else {
try {
O.setFixed(false, O.getStringLength());
} catch (Exception ex) {}
}
reset(zc);
}
public boolean isFixed() {
return false;
}
public void setFixed(final ZirkelCanvas zc, final ConstructionObject o) {
}
public PointObject select(final int x, final int y, final ZirkelCanvas zc, boolean altdown) {
return zc.selectCreatePoint(x, y, altdown);
}
public ConstructionObject create(Construction c,PointObject p1, PointObject p2) {
return new LineObject(c, p1, p2);
}
@Override
public void reset(final ZirkelCanvas zc) {
if (!zc.Visual) {
zc.setPrompt(getPrompt());
} else {
zc.clearSelected();
P1=P2=null;
showStatus(zc);
}
}
public String getPrompt() {
return Global.name("prompt.line");
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1==null) {
zc.showStatus(Global.name("message.line.first",
"Line: Set the first point!"));
} else {
zc.showStatus(Global.name("message.line.second",
"Line: Set the second point!"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Line")) {
return false;
}
final XmlTag tag=tree.getTag();
if (tag.hasParam("xaxis")) {
final AxisObject o=new AxisObject(c, true);
setName(tag, o);
set(tree, o);
c.add(o);
c.xAxis=o;
return true;
}
if (tag.hasParam("yaxis")) {
final AxisObject o=new AxisObject(c, false);
setName(tag, o);
set(tree, o);
c.add(o);
c.yAxis=o;
return true;
}
if (!tag.hasParam("from")||!tag.hasParam("to")) {
if (!(c instanceof Macro)) {
throw new ConstructionException("Line points missing!");
}
final PrimitiveLineObject o=new PrimitiveLineObject(c);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
} else {
try {
final PointObject p1=(PointObject) c.find(tag.getValue("from"));
final PointObject p2=(PointObject) c.find(tag.getValue("to"));
final LineObject o=new LineObject(c, p1, p2);
if (tag.hasParam("partial")) {
o.setPartial(true);
}
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Line points illegal!");
}
}
return true;
}
@Override
public String getTag() {
return "Line";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams!=2) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject P1=c.find(params[0]);
if (P1==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[0]);
}
final ConstructionObject P2=c.find(params[1]);
if (P2==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[1]);
}
if (!(P1 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "+params[0]);
}
if (!(P2 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "+params[1]);
}
final LineObject s=new LineObject(c, (PointObject) P1,
(PointObject) P2);
c.add(s);
s.setDefaults();
if (!name.equals("")) {
s.setNameCheck(name);
}
}
}

View file

@ -0,0 +1,117 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: MidpointConstructor.java
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.MidpointObject;
import rene.zirkel.objects.PointObject;
public class MidpointConstructor extends LineConstructor {
@Override
public ConstructionObject create(final Construction c,
final PointObject p1, final PointObject p2) {
return new MidpointObject(c, p1, p2);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1 == null)
zc.showStatus(Global.name("message.midpoint.first",
"Midpoint: Set the first point!"));
else
zc.showStatus(Global.name("message.midpoint.second",
"Midpoint: Set the second point!"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Midpoint"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("first") || !tag.hasParam("second"))
throw new ConstructionException("Line points missing!");
try {
final PointObject p1 = (PointObject) c.find(tag.getValue("first"));
final PointObject p2 = (PointObject) c.find(tag.getValue("second"));
final MidpointObject p = new MidpointObject(c, p1, p2);
PointConstructor.setType(tag, p);
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Midpoint points illegal!");
}
return true;
}
@Override
public String getPrompt() {
return Global.name("prompt.midpoint");
}
@Override
public String getTag() {
return "Midpoint";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 2)
throw new ConstructionException(Global.name("exception.nparams"));
final ConstructionObject P1 = c.find(params[0]);
if (P1 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[0]);
if (!(P1 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[0]);
final ConstructionObject P2 = c.find(params[1]);
if (P2 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[1]);
if (!(P2 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[1]);
final MidpointObject s = new MidpointObject(c, (PointObject) P1,
(PointObject) P2);
if (!name.equals(""))
s.setNameCheck(name);
c.add(s);
s.setDefaults();
}
}

View file

@ -0,0 +1,328 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: ObjectConstructor.java
import java.awt.Color;
import java.awt.event.MouseEvent;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTagText;
import rene.util.xml.XmlTree;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.ZirkelFrame;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
public class ObjectConstructor {
protected boolean Dragging=false;
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
}
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
}
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
}
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
// System.out.println("moved : "+e.getX()+" "+e.getY());
PointObject p=null;
if (simple&&(waitForPoint()||waitForLastPoint())) {
zc.indicateCreatePoint(e.getX(), e.getY(), false);
return;
}
if (waitForPoint()) {
p=zc.indicateCreatePoint(e.getX(), e.getY(), false);
}
if (waitForLastPoint()) {
if (zc.isPreview()) {
if (p==null) {
zc.movePreview(e);
} else {
zc.movePreview(p.getX(), p.getY());
}
} else {
zc.prepareForPreview(e);
finishConstruction(e, zc);
return;
}
}
}
public void setConstructionObject(ConstructionObject obj,ZirkelCanvas zc){
}
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
}
public boolean waitForLastPoint() {
return false;
}
public boolean waitForPoint() {
return true;
}
public void reset(final ZirkelCanvas zc) {
zc.validate();
zc.clearSelected();
}
public void resetFirstTime(final ZirkelCanvas zc) {
reset(zc);
}
public void invalidate(final ZirkelCanvas zc) {
zc.clearSelectionRectangle();
zc.clearMultipleSelection();
}
public void showStatus(final ZirkelCanvas zc) {
}
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
return false;
}
public boolean testTree(final XmlTree t, final String tag) {
return t.getTag().name().equals(tag);
}
public void setName(final XmlTag tag, final ConstructionObject o) {
if (tag.hasParam("name")) {
o.setName(tag.getValue("name"));
}
if (tag.hasParam("alias")) {
o.setAlias(tag.getValue("alias"));
}
}
public void set(XmlTree tree, final ConstructionObject o)
throws ConstructionException {
final XmlTag tag=tree.getTag();
if (tag.hasParam("n")) {
try {
o.setNCount(new Integer(tag.getValue("n")).intValue());
o.setGotNCount(true);
} catch (final Exception ex) {
throw new ConstructionException("Illegal count!");
}
}
if (tag.hasParam("hidden")) {
if (tag.getValue("hidden").equals("super")) {
o.setSuperHidden(true);
} else {
o.setHidden(true);
}
}
if (tag.hasTrueParam("tracked")) {
o.setTracked(true);
}
if (tag.hasTrueParam("showvalue")) {
o.setShowValue(true);
}
if (tag.hasTrueParam("showname")) {
o.setShowName(true);
}
if (tag.hasTrueParam("background")) {
o.setBack(true);
} else {
o.setBack(false);
}
if (tag.hasTrueParam("parameter")) {
o.setParameter(true);
}
if (tag.hasTrueParam("mainparameter")) {
o.setMainParameter(true);
}
if (tag.hasTrueParam("target")) {
o.setTarget(true);
}
if (tag.hasParam("macroFinalIndex")) {
int x=Integer.parseInt(tag.getValue("macroFinalIndex"));
o.setMacroFinalIndex(x);
}
if (tag.hasTrueParam("break")) {
o.setBreak(true);
}
if (tag.hasTrueParam("hidebreak")) {
o.setHideBreak(true);
}
if (tag.hasTrueParam("solid")) {
o.setSolid(true);
}
if (tag.hasTrueParam("bold")) {
o.setBold(true);
}
if (tag.hasTrueParam("large")) {
o.setLarge(true);
}
if (tag.hasParam("dp_mode")) {
int x=Integer.parseInt(tag.getValue("dp_mode"));
o.setDPMode(x);
}
if (tag.hasParam("xoffset")||tag.hasParam("yoffset")) {
int x=0, y=0;
try {
if (tag.hasParam("xoffset")) {
x=Integer.parseInt(tag.getValue("xoffset"));
}
if (tag.hasParam("yoffset")) {
y=Integer.parseInt(tag.getValue("yoffset"));
}
o.setOffset(x, y);
} catch (final Exception e) {
throw new ConstructionException("Illegal offset value");
}
}
if (tag.hasTrueParam("keepclose")) {
o.setKeepClose(true);
}
if (tag.hasParam("xcoffset")||tag.hasParam("ycoffset")) {
double x=0, y=0;
try {
if (tag.hasParam("xcoffset")) {
x=new Double(tag.getValue("xcoffset")).doubleValue();
}
if (tag.hasParam("ycoffset")) {
y=new Double(tag.getValue("ycoffset")).doubleValue();
}
o.setcOffset(x, y);
} catch (final Exception e) {
throw new ConstructionException("Illegal offset value");
}
}
if (tag.hasParam("color")) {
try {
final String s=tag.getValue("color");
int n=-1;
for (int i=0; i<ZirkelFrame.ColorStrings.length; i++) {
if (s.equals(ZirkelFrame.ColorStrings[i])) {
o.setColor(i);
n=i;
break;
}
}
if (n<0) {
n=Integer.parseInt(s);
if (n<0||n>=ZirkelFrame.Colors.length) {
throw new Exception("");
}
o.setColor(n);
}
} catch (final Exception ex) {
throw new ConstructionException("Illegal color index (1-"
+(ZirkelFrame.Colors.length-1)+")");
}
}
if (tag.hasParam("scolor")) {
String reg="([0-9]+),([0-9]+),([0-9]+)";
Matcher m=Pattern.compile(reg).matcher(tag.getValue("scolor"));
// Si une couleur RGB est trouvée, dans un format antérieur à la 3.5.5,
// soit par exemple "175,250,99" :
if (m.find()) {
int red=Integer.parseInt(m.group(1));
int green=Integer.parseInt(m.group(2));
int blue=Integer.parseInt(m.group(3));
o.setSpecialColor(new Color(red, green, blue));
} else {
reg="(.+),,(.+),,(.+)";
m=Pattern.compile(reg).matcher(tag.getValue("scolor"));
// Si une couleur RGB est trouvée, dans un format à partir de la 3.5.5,
// soit par exemple "x(A)*255,,y(A)*255,,99" :
if (m.find()) {
o.setSpecialColor(m.group(1), m.group(2), m.group(3));
}
}
}
if (tag.hasParam("type")) {
final String type=tag.getValue("type");
if (type.equals("thick")) {
o.setColorType(ConstructionObject.THICK);
}
if (type.equals("thin")) {
o.setColorType(ConstructionObject.THIN);
}
if (type.equals("invisible")) {
o.setColorType(ConstructionObject.INVISIBLE);
}
}
if (tag.hasParam("unit")) {
o.setUnit(tag.getValue("unit"));
} else {
o.setUnit("");
}
final Enumeration e=tree.getContent();
while (e.hasMoreElements()) {
tree=(XmlTree) e.nextElement();
if (tree.getTag() instanceof XmlTagText) {
o.setText(((XmlTagText) tree.getTag()).getContent(), true);
}
}
}
public void setConditionals(final XmlTree tree, final Construction c,
final ConstructionObject o) {
o.clearConditionals();
int i=0;
final XmlTag tag=tree.getTag();
while (tag.hasParam("ctag"+i)&&tag.hasParam("cexpr"+i)) {
final String t=tag.getValue("ctag"+i);
final String e=tag.getValue("cexpr"+i);
final Expression ex=new Expression(e, c, o);
o.addConditional(t, ex);
i++;
}
}
public String getTag() {
return "???";
}
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
throw new ConstructionException("");
}
// for MetaMover :
public void pause(final boolean flag) {
}
public boolean useSmartBoard() {
return true;
}
}

View file

@ -0,0 +1,243 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: ParallelConstructor.java
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.ParallelObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PrimitiveLineObject;
public class ParallelConstructor extends ObjectConstructor {
PointObject P=null;
PrimitiveLineObject L=null;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
if (!zc.Visual) {
return;
}
ConstructionObject obj=null;
if (L==null) {
obj=selectline(e.getX(), e.getY(), zc);
} else {
obj=select(e.getX(), e.getY(), zc, e.isAltDown());
}
setConstructionObject(obj, zc);
}
@Override
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc) {
if (L==null) {
if (obj instanceof PrimitiveLineObject) {
L=(PrimitiveLineObject) obj;
L.setSelected(true);
zc.repaint();
}
} else if (P==null) {
if (obj instanceof PointObject) {
P=(PointObject) obj;
final ConstructionObject o=create(zc.getConstruction(), L, P);
zc.addObject(o);
o.setDefaults();
P=null;
L=null;
zc.clearSelected();
}
}
showStatus(zc);
}
@Override
public boolean waitForLastPoint() {
return L!=null;
}
@Override
public void finishConstruction(final MouseEvent e, final ZirkelCanvas zc) {
P=select(e.getX(), e.getY(), zc, e.isAltDown());
if (P!=null) {
final ConstructionObject o=create(zc.getConstruction(), L, P);
zc.addObject(o);
o.setDefaults();
zc.validate();
zc.repaint();
P=null;
}
}
// @Override
// public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
// final boolean simple) {
// if (!simple && waitForLastPoint()) {
// if (zc.isPreview()) {
// zc.movePreview(e);
// } else {
// zc.prepareForPreview(e);
// finishConstruction(e, zc);
// }
// }
// if (L == null)
// zc.indicateLineObjects(e.getX(), e.getY());
// else if (P == null)
// zc.indicateCreatePoint(e.getX(), e.getY(), false);
// }
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc,
final boolean simple) {
if (L==null) {
zc.indicateLineObjects(e.getX(), e.getY());
} else if (P==null) {
PointObject p=zc.indicateCreatePoint(e.getX(), e.getY(), false);
if (!simple&&waitForLastPoint()) {
if (zc.isPreview()) {
if (p==null) {
zc.movePreview(e);
} else {
zc.movePreview(p.getX(), p.getY());
}
} else {
zc.prepareForPreview(e);
finishConstruction(e, zc);
}
}
}
}
public PointObject select(final int x, final int y, final ZirkelCanvas zc, boolean altdown) {
return zc.selectCreatePoint(x, y, altdown);
}
public PrimitiveLineObject selectline(final int x, final int y,
final ZirkelCanvas zc) {
return zc.selectLine(x, y);
}
public PrimitiveLineObject create(final Construction c,
final PrimitiveLineObject l, final PointObject p) {
return new ParallelObject(c, l, p);
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
P=null;
L=null;
showStatus(zc);
} else {
zc.setPrompt(getPrompt());
}
}
public String getPrompt() {
return Global.name("prompt.parallel");
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (L==null) {
zc.showStatus(Global.name("message.parallel.first",
"Parallel: Choose a line!"));
} else {
zc.showStatus(Global.name("message.parallel.second",
"Parallel: Choose a Point!"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Parallel")) {
return false;
}
final XmlTag tag=tree.getTag();
if (!tag.hasParam("point")||!tag.hasParam("line")) {
throw new ConstructionException("Parallel parameters missing!");
}
try {
final PointObject p1=(PointObject) c.find(tag.getValue("point"));
final PrimitiveLineObject p2=(PrimitiveLineObject) c.find(tag.getValue("line"));
final ParallelObject o=new ParallelObject(c, p2, p1);
setName(tag, o);
set(tree, o);
if (tag.hasParam("partial")) {
o.setPartial(true);
}
c.add(o);
setConditionals(tree, c, o);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Parallel parameters illegal!");
}
return true;
}
@Override
public String getTag() {
return "Parallel";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams!=2) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject P1=c.find(params[0]);
if (P1==null) {
throw new ConstructionException(Global.name("exception.notfound")
+" "+params[0]);
}
final ConstructionObject P2=c.find(params[1]);
if (P2==null) {
throw new ConstructionException(Global.name("exception.notfound")
+" "+params[1]);
}
if (!(P1 instanceof PrimitiveLineObject)) {
throw new ConstructionException(Global.name("exception.type")+" "
+params[0]);
}
if (!(P2 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "
+params[1]);
}
final ParallelObject s=new ParallelObject(c,
(PrimitiveLineObject) P1, (PointObject) P2);
if (!name.equals("")) {
s.setNameCheck(name);
}
c.add(s);
s.setDefaults();
}
}

View file

@ -0,0 +1,121 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PlumbConstructor.java
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PlumbObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PrimitiveLineObject;
public class PlumbConstructor extends ParallelConstructor {
@Override
public PrimitiveLineObject create(final Construction c,
final PrimitiveLineObject l, final PointObject p) {
return new PlumbObject(c, l, p);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (L == null)
zc.showStatus(Global.name("message.plumb.first",
"Plumb Line: Choose a line!"));
else
zc.showStatus(Global.name("message.plumb.second",
"Plumb Line: Choose a Point!"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Plumb"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("point") || !tag.hasParam("line"))
throw new ConstructionException("Plumb parameters missing!");
try {
final PointObject p1 = (PointObject) c.find(tag.getValue("point"));
final PrimitiveLineObject p2 = (PrimitiveLineObject) c.find(tag
.getValue("line"));
final PlumbObject o = new PlumbObject(c, p2, p1);
if (tag.hasParam("valid"))
o.setRestricted(false);
setName(tag, o);
set(tree, o);
if (tag.hasParam("partial"))
o.setPartial(true);
c.add(o);
setConditionals(tree, c, o);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Plumb parameters illegal!");
}
return true;
}
@Override
public String getPrompt() {
return Global.name("prompt.plumb");
}
@Override
public String getTag() {
return "Plumb";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 2)
throw new ConstructionException(Global.name("exception.nparams"));
final ConstructionObject P1 = c.find(params[0]);
if (P1 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[0]);
final ConstructionObject P2 = c.find(params[1]);
if (P2 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[1]);
if (!(P1 instanceof PrimitiveLineObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[0]);
if (!(P2 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[1]);
final PlumbObject s = new PlumbObject(c, (PrimitiveLineObject) P1,
(PointObject) P2);
if (!name.equals(""))
s.setNameCheck(name);
c.add(s);
s.setDefaults();
}
}

View file

@ -0,0 +1,308 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import java.util.ArrayList;
import java.util.Enumeration;
import eric.JSelectPopup;
import eric.GUI.palette.PaletteManager;
import eric.bar.JPropertiesBar;
import java.awt.event.MouseEvent;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.AreaObject;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
import rene.zirkel.objects.PrimitiveCircleObject;
import rene.zirkel.objects.PrimitiveLineObject;
public class PointConstructor extends ObjectConstructor {
// boolean Fix;
PointObject P;
boolean ShowsValue, ShowsName;
boolean ShiftDown=false;
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
ShiftDown=e.isShiftDown();
final PointObject o=zc.selectCreatePoint(e.getX(), e.getY(), false,
true, e.isAltDown());
setConstructionObject(o, zc);
}
@Override
public void setConstructionObject(ConstructionObject obj, ZirkelCanvas zc) {
Dragging=false;
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(obj instanceof PointonObject)) {
int x=JSelectPopup.getMouseX();
int y=JSelectPopup.getMouseY();
PointObject o=new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), obj);
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
} else if (obj instanceof PointObject) {
PointObject o=(PointObject) obj;
if (o.isPointOn()) // create a point on an object
{
if (ShiftDown&&zc.isNewPoint()) {
o.setUseAlpha(true);
}
} else if (o.moveable()&&zc.isNewPoint()&&!zc.getAxis_show()) {
P=o;
ShowsValue=P.showValue();
ShowsName=P.showName();
Dragging=true;
zc.repaint();
} else if (o.moveable()&&zc.isNewPoint()&&zc.getAxis_show()&&ShiftDown) {
P=o;
try {
P.setFixed(""+P.round(P.getX(), ZirkelCanvas.LengthsFactor),
""+P.round(P.getY(), ZirkelCanvas.LengthsFactor));
P.edit(zc, true, true);
P.validate();
} catch (final Exception ex) {
}
} else if (ShiftDown&&!zc.isNewPoint()) {
final PointObject p=new PointObject(zc.getConstruction(), o.getX(), o.getY());
zc.addObject(p);
p.setFixed(true);
}
}
}
@Override
public void mouseDragged(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
}
if (Global.getParameter("options.movename", false)) {
P.setShowValue(true);
P.setShowName(true);
}
P.move(zc.x(e.getX()), zc.y(e.getY()));
zc.repaint();
}
@Override
public void mouseReleased(final MouseEvent e, final ZirkelCanvas zc) {
if (!Dragging) {
return;
}
Dragging=false;
P.setShowValue(ShowsValue);
P.setShowName(ShowsName);
P.updateText();
zc.repaint();
if (ShiftDown) {
try {
P.setFixed(""+P.round(P.getX(), ZirkelCanvas.LengthsFactor),
""+P.round(P.getY(), ZirkelCanvas.LengthsFactor));
JPropertiesBar.EditObject(P);
P.validate();
} catch (final Exception ex) {
}
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.point", "Point: Set a point!"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Point")) {
return false;
}
final XmlTag tag=tree.getTag();
if (!tag.hasParam("x")||!tag.hasParam("y")) {
throw new ConstructionException("Point coordinates missing!");
}
double x=0, y=0;
double x3D=0, y3D=0, z3D=0;
try {
if (tag.hasParam("actx")) {
x=new Double(tag.getValue("actx")).doubleValue();
// System.out.println(x);
}
if (tag.hasParam("acty")) {
y=new Double(tag.getValue("acty")).doubleValue();
}
} catch (final Exception e) {
}
final PointObject p=new PointObject(c, x, y);
try {
x=new Expression(tag.getValue("x"), c, p).getValue();
y=new Expression(tag.getValue("y"), c, p).getValue();
p.move(x, y);
} catch (final Exception e) {
}
if (tag.hasParam("is3D")) {
p.setIs3D(true);
try {
x3D=new Expression(tag.getValue("x3D"), c, p).getValue();
y3D=new Expression(tag.getValue("y3D"), c, p).getValue();
z3D=new Expression(tag.getValue("z3D"), c, p).getValue();
p.move3D(x3D, y3D, z3D);
} catch (final Exception e) {
}
}
setType(tag, p);
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
if (tag.hasParam("fixed")) {
p.setFixed(tag.getValue("x"), tag.getValue("y"));
}
if (tag.hasParam("fixed3D")) {
p.setFixed(tag.getValue("x3D"), tag.getValue("y3D"), tag.getValue("z3D"));
}
if (tag.hasParam("increment")) {
try {
p.setIncrement(new Double(tag.getValue("increment")).doubleValue());
} catch (final Exception e) {
}
}
if (tag.hasParam("magnetobjs")) {
// must manage the magnet list after the whole construction is
// loaded (see zc.load)
c.magnet.add(p);
c.magnet.add(tag.getValue("magnetobjs"));
p.setMagnetRayExp(tag.getValue("magnetd"));
}
return true;
}
static public void setType(final XmlTag tag, final PointObject p) {
if (tag.hasParam("shape")) {
final String s=tag.getValue("shape");
if (s.equals("square")) {
p.setType(0);
}
if (s.equals("diamond")) {
p.setType(1);
}
if (s.equals("circle")) {
p.setType(2);
}
if (s.equals("dot")) {
p.setType(3);
}
if (s.equals("cross")) {
p.setType(4);
}
if (s.equals("dcross")) {
p.setType(5);
}
}
}
@Override
public String getTag() {
return "Point";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams==0) {
final PointObject p=new PointObject(c, c.getX()+(Math.random()-0.5)*c.getW(), c.getY()+(Math.random()-0.5)*c.getW());
if (!name.equals("")) {
p.setNameCheck(name);
}
c.add(p);
p.setDefaults();
return;
}
if (nparams==1) {
final ConstructionObject o=c.find(params[0]);
if (o==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[0]);
}
if (!(o instanceof PrimitiveLineObject)&&!(o instanceof PrimitiveCircleObject)) {
throw new ConstructionException(Global.name("exception.type")+" "+params[0]);
}
final PointObject p=new PointObject(c, c.getX()+(Math.random()-0.5)*c.getW(), c.getY()+(Math.random()-0.5)*c.getW(), o);
if (!name.equals("")) {
p.setNameCheck(name);
}
c.add(p);
p.setDefaults();
return;
}
if (nparams!=2) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final Expression e1=new Expression(params[0], c, null);
final Expression e2=new Expression(params[1], c, null);
if (!e1.isValid()||!e2.isValid()) {
throw new ConstructionException(Global.name("exception.expression"));
}
final PointObject p=new PointObject(c, 0, 0);
try {
final double x=new Double(params[0]).doubleValue();
final double y=new Double(params[1]).doubleValue();
p.move(x, y);
} catch (final Exception e) {
p.setFixed(params[0], params[1]);
}
c.add(p);
p.validate();
p.setDefaults();
if (!name.equals("")) {
p.setNameCheck(name);
}
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
zc.setPrompt(Global.name("prompt.point"));
}
}

View file

@ -0,0 +1,244 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: QuadricConstructor.java
import eric.JSelectPopup;
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.PointonObject;
import rene.zirkel.objects.QuadricObject;
public class QuadricConstructor extends ObjectConstructor {
private PointObject Points[];
private int NPoints;
private static PointObject previewPoint;
private QuadricObject Quadric;
private boolean newPoint = false;
public static void deletePreview(final ZirkelCanvas zc) {
zc.reset();
}
public void validQuadric(ZirkelCanvas zc){
if(Quadric!=null){
zc.clearSelected();
Quadric.updateText();
initialize();
}
}
public void initialize(){
previewPoint = null;
Quadric = null;
NPoints = 0;
Points = new PointObject[5];
}
private void arrangePoints() {
if (NPoints<5) {
Points[4]=previewPoint;
for (int i=3; i>=NPoints; i--) {
Points[i]=Points[0];
}
}
}
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc){
if (!zc.Visual) {
return;
}
if (previewPoint==null) {
previewPoint = new PointObject(zc.getConstruction(), "PrevPoint");
}
HideQuadric(true);
final PointObject P = zc.selectCreatePoint(e.getX(), e.getY(), e.isAltDown());
HideQuadric(false);
newPoint = newPoint || zc.isNewPoint();
setConstructionObject(P, zc);
}
@Override
public void setConstructionObject(ConstructionObject P, ZirkelCanvas zc){
// Il y a eu ambiguité et la méthode est forcément appelée par le
// popupmenu de sélection :
if ((JSelectPopup.isCallerObject())&&(P instanceof PointonObject)) {
int x = JSelectPopup.getMouseX();
int y = JSelectPopup.getMouseY();
PointObject o = new PointObject(zc.getConstruction(), zc.x(x), zc.y(y), P);
newPoint = true;
o.setUseAlpha(true);
zc.addObject(o);
zc.validate();
o.setDefaults();
zc.repaint();
o.edit(zc, false, false);
P=o;
}
if(P!=null){
Points[NPoints++] = (PointObject)P;
P.setSelected(true);
if(Quadric==null){
arrangePoints();
Quadric = new QuadricObject(zc.getConstruction(), Points);
zc.addObject(Quadric);
Quadric.setDefaults();
zc.repaint();
}
if (NPoints==5) {
validQuadric(zc);
// Si on a créé un sommet à la volée, il faut réorganiser la construction
// pour éviter un pb de dépendance
if(newPoint){
zc.getConstruction().reorderConstruction();
zc.reloadCD();
newPoint = false;
}
}
}
showStatus(zc);
}
public void HideQuadric(boolean b){
if(Quadric!=null)
Quadric.setHidden(b);
}
@Override
public void mouseMoved(final MouseEvent e, final ZirkelCanvas zc, final boolean simple) {
if (previewPoint!=null) {
previewPoint.move(zc.x(e.getX()), zc.y(e.getY()));
HideQuadric(true);
if (waitForPoint()) {
PointObject pt = zc.indicateCreatePoint(e.getX(), e.getY(), false);
if (zc.getConstruction().indexOf(pt)!=-1) {
previewPoint.move(pt.getX(), pt.getY());
}
}
HideQuadric(false);
Quadric.setDefaults();
Quadric.validate();
zc.repaint();
}
else super.mouseMoved(e, zc, simple);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.quadric")+" "+(NPoints+1));
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
if (zc.Visual) {
if(Quadric!=null){
zc.delete(Quadric);
}
initialize();
showStatus(zc);
} else {
zc.setPrompt(Global.name("prompt.quadric"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Quadric")) {
return false;
}
final XmlTag tag=tree.getTag();
for (int i=0; i<5; i++) {
if (!tag.hasParam("point"+(i+1))) {
throw new ConstructionException("Quadric points missing!");
}
}
try {
final PointObject P[]=new PointObject[5];
for (int i=0; i<5; i++) {
P[i]=(PointObject) c.find(tag.getValue("point"+(i+1)));
}
final QuadricObject p=new QuadricObject(c, P);
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Quadric points illegal!");
}
return true;
}
public String getPrompt() {
return Global.name("prompt.quadric");
}
@Override
public String getTag() {
return "Quadric";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams!=5) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject P[]=new PointObject[5];
for (int i=0; i<5; i++) {
P[i]=c.find(params[i]);
if (P[i]==null) {
throw new ConstructionException(Global.name("exception.notfound")
+" "+params[i]);
}
if (!(P[i] instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")
+" "+params[i]);
}
}
final QuadricObject s=new QuadricObject(c, (PointObject[]) P);
if (!name.equals("")) {
s.setNameCheck(name);
}
c.add(s);
s.setDefaults();
}
}

View file

@ -0,0 +1,121 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: RayConstructor.java
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.RayObject;
public class RayConstructor extends LineConstructor {
@Override
public ConstructionObject create(final Construction c,
final PointObject p1, final PointObject p2) {
return new RayObject(c, p1, p2);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1==null) {
zc.showStatus(Global.name("message.ray.first",
"Ray: Set the root point!"));
} else {
zc.showStatus(Global.name("message.ray.second",
"Ray: Set the second point!"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Ray")) {
return false;
}
final XmlTag tag=tree.getTag();
if (!tag.hasParam("from")||!tag.hasParam("to")) {
throw new ConstructionException("Ray points missing!");
}
try {
final PointObject p1=(PointObject) c.find(tag.getValue("from"));
final PointObject p2=(PointObject) c.find(tag.getValue("to"));
final RayObject o=new RayObject(c, p1, p2);
if (tag.hasParam("partial")) {
o.setPartial(true);
}
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
e.printStackTrace();
throw new ConstructionException("Ray points illegal!");
}
return true;
}
@Override
public String getPrompt() {
return Global.name("prompt.ray");
}
@Override
public String getTag() {
return "Ray";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams!=2) {
throw new ConstructionException(Global.name("exception.nparams"));
}
final ConstructionObject P1=c.find(params[0]);
if (P1==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[0]);
}
final ConstructionObject P2=c.find(params[1]);
if (P2==null) {
throw new ConstructionException(Global.name("exception.notfound")+" "+params[1]);
}
if (!(P1 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "+params[0]);
}
if (!(P2 instanceof PointObject)) {
throw new ConstructionException(Global.name("exception.type")+" "+params[1]);
}
final RayObject s=new RayObject(c, (PointObject) P1, (PointObject) P2);
c.add(s);
s.setDefaults();
if (!name.equals("")) {
s.setNameCheck(name);
}
}
}

View file

@ -0,0 +1,192 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: SegmentConstructor.java
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.SegmentObject;
public class SegmentConstructor extends LineConstructor {
boolean Fixed = false;
public SegmentConstructor() {
this(false);
}
public SegmentConstructor(final boolean fixed) {
Fixed = fixed;
}
@Override
public ConstructionObject create(final Construction c,
final PointObject p1, final PointObject p2) {
return new SegmentObject(c, p1, p2);
}
@Override
public boolean isFixed() {
return Fixed;
}
@Override
public void setFixed(final ZirkelCanvas zc, final ConstructionObject o) {
if (o instanceof SegmentObject) {
final SegmentObject s = (SegmentObject) o;
if (s.canFix())
try {
s.validate();
s.setFixed(true, "" + s.getLength());
s.edit(zc, true, true);
s.validate();
zc.repaint();
} catch (final Exception e) {
}
else {
zc.warning(Global.name("error.fixedsegment"));
}
}
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (!Fixed) {
if (P1 == null)
zc.showStatus(Global.name("message.segment.first"));
else
zc.showStatus(Global.name("message.segment.second"));
} else {
if (P1 == null)
zc.showStatus(Global.name("message.fixedsegment.first"));
else
zc.showStatus(Global.name("message.fixedsegment.second"));
}
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Segment"))
return false;
final XmlTag tag = tree.getTag();
if(tag.hasParam("arrow"))
return false; //parceque VectorConstructor est appelé après dans l'ordre chronologique
if (!tag.hasParam("from") || !tag.hasParam("to"))
throw new ConstructionException("Segment endpoints missing!");
try {
final PointObject p1 = (PointObject) c.find(tag.getValue("from"));
final PointObject p2 = (PointObject) c.find(tag.getValue("to"));
final SegmentObject o = new SegmentObject(c, p1, p2);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
//o.setArrow(tag.hasParam("arrow")); plus nécessaire
if (tag.hasParam("fixed")) {
try {
o.setFixed(true, tag.getValue("fixed"));
} catch (final Exception e) {
throw new ConstructionException("Fixed value illegal!");
}
}
if (tag.hasParam("code_symbol"))
o.setSegmentCode(Integer.parseInt(tag.getValue("code_symbol")));
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Segment endpoints illegal!");
}
return true;
}
@Override
public String getPrompt() {
return Global.name("prompt.segment");
}
@Override
public String getTag() {
return "Segment";
}
@Override
public void construct(final Construction c, final String name,
final String params[], final int nparams)
throws ConstructionException {
if (nparams != 2 && nparams != 3)
throw new ConstructionException(Global.name("exception.nparams"));
final ConstructionObject P1 = c.find(params[0]);
if (P1 == null)
throw new ConstructionException(Global.name("exception.notfound")
+ " " + params[0]);
if (!(P1 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[0]);
ConstructionObject P2 = c.find(params[1]);
if (P2 == null) {
final Expression ex = new Expression(params[1], c, null);
if (!ex.isValid())
throw new ConstructionException(Global.name("exception.expression"));
final double x = ex.getValue();
P2 = new PointObject(c, ((PointObject) P1).getX() + x,
((PointObject) P1).getY());
c.add(P2);
P2.setDefaults();
final SegmentObject s = new SegmentObject(c, (PointObject) P1,
(PointObject) P2);
s.setDefaults();
s.setFixed(true, params[1]);
c.add(s);
if (!name.equals(""))
s.setNameCheck(name);
return;
}
if (!(P2 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "
+ params[1]);
final SegmentObject s = new SegmentObject(c, (PointObject) P1,
(PointObject) P2);
if (nparams == 3) {
if (!s.canFix())
throw new ConstructionException(Global.name("exception.canfix"));
s.setFixed(true, params[2]);
if (!s.isValidFix())
throw new ConstructionException(Global.name("exception.fix")
+ " " + params[2]);
s.validate();
}
c.add(s);
s.setDefaults();
// s.setArrow(c.isVector());
if (!name.equals(""))
s.setNameCheck(name);
}
}

View file

@ -0,0 +1,90 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.constructors;
// file: PointConstructor.java
import java.awt.event.MouseEvent;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.gui.Global;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.TextObject;
public class TextConstructor extends ObjectConstructor {
@Override
public void mousePressed(final MouseEvent e, final ZirkelCanvas zc) {
final double x = zc.x(e.getX()), y = zc.y(e.getY());
final TextObject p = new TextObject(zc.getConstruction(), x, y);
zc.addObject(p);
p.edit(zc, true, true);
p.setDefaults();
zc.repaint();
}
@Override
public boolean waitForPoint() {
return false;
}
@Override
public void showStatus(final ZirkelCanvas zc) {
zc.showStatus(Global.name("message.text"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c)
throws ConstructionException {
if (!testTree(tree, "Text"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("x") || !tag.hasParam("y"))
throw new ConstructionException("Point coordinates missing!");
final TextObject p = new TextObject(c, 0, 0);
double x, y;
try {
x = new Expression(tag.getValue("x"), c, p).getValue();
y = new Expression(tag.getValue("y"), c, p).getValue();
p.move(x, y);
} catch (final Exception e) {
}
setName(tag, p);
set(tree, p);
c.add(p);
setConditionals(tree, c, p);
p.setLines(p.getText());
if (tag.hasParam("fixed")) {
p.setFixed(tag.getValue("x"), tag.getValue("y"));
}
return true;
}
@Override
public void reset(final ZirkelCanvas zc) {
super.reset(zc);
showStatus(zc);
}
}

View file

@ -0,0 +1,145 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.constructors;
import rene.gui.Global;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTree;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.expression.Expression;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import rene.zirkel.objects.VectorObject;
/**
*
* @author PM
*/
public class VectorConstructor extends SegmentConstructor{
public VectorConstructor(){
this(false);
}
public VectorConstructor(boolean fixed){
Fixed = fixed;
}
@Override
public ConstructionObject create(final Construction c, final PointObject p1, final PointObject p2) {
return new VectorObject(c, p1, p2);
}
@Override
public void showStatus(final ZirkelCanvas zc) {
if (P1 == null)
zc.showStatus(Global.name("message.vector.first"));
else
zc.showStatus(Global.name("message.vector.second"));
}
@Override
public boolean construct(final XmlTree tree, final Construction c) throws ConstructionException {
if (!testTree(tree, "Segment"))
return false;
final XmlTag tag = tree.getTag();
if (!tag.hasParam("from") || !tag.hasParam("to"))
throw new ConstructionException("Segment endpoints missing!");
try {
final PointObject p1 = (PointObject) c.find(tag.getValue("from"));
final PointObject p2 = (PointObject) c.find(tag.getValue("to"));
final VectorObject o = new VectorObject(c, p1, p2);
setName(tag, o);
set(tree, o);
c.add(o);
setConditionals(tree, c, o);
//o.setArrow(tag.hasParam("arrow"));
if(tag.hasParam("x") && tag.hasParam("y")){
o.setEXY(tag.getValue("x"), tag.getValue("y"));
}
if (tag.hasParam("is3D")) {
o.setIs3D(true);
}
if(tag.hasParam("x3D") && tag.hasParam("y3D")&& tag.hasParam("z3D")){
o.setEXYZ(tag.getValue("x3D"), tag.getValue("y3D"), tag.getValue("z3D"));
}
if (tag.hasParam("fixed")) {
try {
o.setFixed(true, tag.getValue("fixed"));
} catch (final Exception e) {
throw new ConstructionException("Fixed value illegal!");
}
}
if (tag.hasParam("fixed3D")) {
try {
o.setFixed(true, tag.getValue("fixed3D"));
} catch (final Exception e) {
throw new ConstructionException("Fixed 3D value illegal!");
}
}
if (tag.hasParam("code_symbol"))
o.setSegmentCode(Integer.parseInt(tag.getValue("code_symbol")));
} catch (final ConstructionException e) {
throw e;
} catch (final Exception e) {
throw new ConstructionException("Segment endpoints illegal!");
}
return true;
}
@Override
public void construct(final Construction c, final String name, final String params[], final int nparams)
throws ConstructionException {
if (nparams != 2 && nparams != 3)
throw new ConstructionException(Global.name("exception.nparams"));
final ConstructionObject P1 = c.find(params[0]);
if (P1 == null)
throw new ConstructionException(Global.name("exception.notfound")+ " " + params[0]);
if (!(P1 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "+ params[0]);
ConstructionObject P2 = c.find(params[1]);
if (P2 == null) {
final Expression ex = new Expression(params[1], c, null);
if (!ex.isValid())
throw new ConstructionException(Global.name("exception.expression"));
final double x = ex.getValue();
P2 = new PointObject(c, ((PointObject) P1).getX() + x, ((PointObject) P1).getY());
c.add(P2);
P2.setDefaults();
final VectorObject s = new VectorObject(c, (PointObject) P1, (PointObject) P2);
s.setDefaults();
s.setFixed(true, params[1]);
c.add(s);
if (!name.equals(""))
s.setNameCheck(name);
return;
}
if (!(P2 instanceof PointObject))
throw new ConstructionException(Global.name("exception.type") + " "+ params[1]);
final VectorObject s = new VectorObject(c, (PointObject) P1, (PointObject) P2);
if (nparams == 3) {
if (!s.canFix())
throw new ConstructionException(Global.name("exception.canfix"));
s.setFixed(true, params[2]);
if (!s.isValidFix())
throw new ConstructionException(Global.name("exception.fix")+ " " + params[2]);
s.validate();
}
c.add(s);
s.setDefaults();
// s.setArrow(c.isVector());
if (!name.equals(""))
s.setNameCheck(name);
}
}

View file

@ -0,0 +1,195 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.dialogs;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
import java.util.Enumeration;
import java.util.Vector;
import rene.gui.ButtonAction;
import rene.gui.CloseDialog;
import rene.gui.Global;
import rene.gui.IconBar;
import rene.gui.IconBarListener;
import rene.gui.Panel3D;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.TextObject;
public class Replay extends CloseDialog implements IconBarListener {
/**
*
*/
private static final long serialVersionUID = 1L;
ZirkelCanvas ZC;
int Last;
Construction C;
Vector V; // Copied vector of visible objects
boolean HaveBreaks;
public Replay(final Frame f, final ZirkelCanvas zc) {
super(f, Global.name("replay.title"), true);
ZC = zc;
C = zc.getConstruction();
// Collect all visible Elements:
V = new Vector();
final Enumeration e = C.elements();
while (e.hasMoreElements()) {
final ConstructionObject o = (ConstructionObject) e.nextElement();
if (!o.mustHide(ZC)
|| o.isBreakHide()
|| (o instanceof TextObject && o.valid() && !o
.isSuperHidden())) {
V.addElement(o);
}
}
HaveBreaks = haveBreaks();
Last = 0;
setLast();
setEnabled(true);
pack();
}
public void iconPressed(final String o) {
if (o.equals("close")) {
doclose();
} else if (o.equals("allback")) {
Last = 0;
setLast();
} else if (o.equals("allforward")) {
Last = V.size();
setLast();
} else if (o.equals("fastback")) {
Last -= 10;
if (Last < 0)
Last = 0;
setLast();
} else if (o.equals("fastforward")) {
Last += 10;
if (Last > V.size())
Last = V.size();
setLast();
} else if (o.equals("oneforward")) {
Last++;
if (Last > V.size())
Last = V.size();
setLast();
} else if (o.equals("nextbreak")) {
while (true) {
Last++;
if (Last > V.size()) {
Last = V.size();
break;
}
if (Last >= V.size()
|| (Last > 0 && ((ConstructionObject) V.elementAt(Last))
.isBreak()))
break;
}
setLast();
} else if (o.equals("setbreak")) {
if (Last > 0) {
final ConstructionObject ob = (ConstructionObject) V
.elementAt(Last);
ob.setBreak(!ob.isBreak());
if (ob.isBreak() )
ob.setBreak(true);
}
HaveBreaks = haveBreaks();
} else if (o.equals("oneback")) {
Last--;
if (Last < 0)
Last = 0;
setLast();
}
start();
}
public void start() {
}
@Override
public void doclose() {
ZC.paintUntil(null);
ZC.showStatus();
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final ConstructionObject o = (ConstructionObject) e.nextElement();
if (o instanceof TextObject)
((TextObject) o).setDoShow(false);
}
ZC.repaint();
super.doclose();
}
ConstructionObject O = null;
public void checkLast() {
if (O != null)
((TextObject) O).setDoShow(false);
O = null;
if (Last > V.size() - 1)
return;
O = (ConstructionObject) V.elementAt(Last);
if (O != null && (O instanceof TextObject))
((TextObject) O).setDoShow(true);
else
O = null;
}
public void setLast() {
if (Last < V.size()) {
final ConstructionObject o = (ConstructionObject) V.elementAt(Last);
checkLast();
ZC.paintUntil(o);
} else {
Last = V.size();
checkLast();
ZC.paintUntil(null);
}
if (Last >= 0 && Last < V.size()) {
final ConstructionObject o = (ConstructionObject) V.elementAt(Last);
ZC.showStatus(o.getName() + " : " + o.getText());
} else {
}
}
public boolean haveBreaks() {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
if (((ConstructionObject) e.nextElement()).isBreak())
return true;
}
return false;
}
}

BIN
rene/zirkel/docs/.DS_Store vendored Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,867 @@
language=da_
homefile=index.html
about.title=Om programmet
about.name=JavaPasser
about.programmed=Programmet er skrevet af
title=Passer
close=Luk
ok=OK
cancel=Annuller
abort=Annuller
done=Godt! Opgaven er løst
message=Meddelelse
warning=Advarsel
yes=Ja
no=Nej
true=sand
false=falsk
warning.nojob=Dette er ikke en opgave
warning.print=Udskrivningsfejl
warning.reset=Valget får virkning næste gang programmet startes
question.title=Spørgsmål
question.intersection=Skal skæringen konstrueres?
question.pointon=Konstruér et punkt på dette objekt?
colors.black=Sort
colors.blue=Blå
colors.green=Grøn
colors.brown=Brun
colors.cyan=Turkis
colors.red=Rød
objects.point=Punkt
objects.segment=Linjestykke
objects.line=Linje
objects.ray=Halvlinje
objects.circle=Cirkel
objects.intersection=Skæringspunkt
objects.move=Flyt punkt
objects.hide=Skjul objekt
objects.edit=Egenskaber
objects.tracker=Spor
objects.objecttracker=Automatisk spor
objects.parallel=Parallel
objects.plumb=Normal
objects.circle3=Cirkel ud fra r og C
objects.midpoint=Midtpunkt
objects.quadric=Keglesnit
objects.angle=Vinkel
objects.boundedpoint=Punkt på objekt
objects.parameter=Angiv makro-parameter
objects.targets=Angiv makroens mål
objects.definejob=Definer en opgave
objects.runmacro=Kør makro
objects.delete=Slet objekter og deraf afhængige
objects.reorder=Flyt objekt opad på listen
objects.animate=Animation
objects.expression=Beregningsudtryk
objects.area=Polygon
objects.text=Tekst
objects.fixedcircle=Cirkel med fast radius
objects.fixedangle=Vinkel med fast gradtal
objects.fixedsegment=Linjestykke med fast længde
iconhelp.point=Punkt
iconhelp.segment=Linjestykke
iconhelp.line=Linje
iconhelp.ray=Halvlinje
iconhelp.circle=Cirkel
iconhelp.intersection=Skæringspunkt
iconhelp.move=Flyt punkt
iconhelp.hide=Skjul objekt
iconhelp.edit=Indstil objektegenskaber
iconhelp.tracker=Spor
iconhelp.objecttracker=Automatisk spor
iconhelp.parallel=Parallel
iconhelp.plumb=Normal
iconhelp.circle3=Cirkel ud fra r og M
iconhelp.midpoint=Midtpunkt
iconhelp.quadric=Keglesnit
iconhelp.angle=Marker vinkel
iconhelp.boundedpoint=Punkt på objekt
iconhelp.hidden=Vis skjulte objekter
iconhelp.color=Farve på næste objekt
iconhelp.type=Type af næste punkt
iconhelp.thickness=Bredde på næste objekt
iconhelp.back=Slet sidste objekt
iconhelp.type0=Type af næste punkt
iconhelp.thickness0=Bredde på næste objekt
iconhelp.partial=Delvist synlige cirkler
iconhelp.plines=Delvist synlige linjer
iconhelp.arrow=Linjestykker som vektorer
iconhelp.showcolor=Vis udvalgte farver
iconhelp.runmacro=Kør makro
iconhelp.macro=Makro parametre/mål/definer
iconhelp.expression=Beregningsudtryk
iconhelp.showvalue=Vis objekternes værdier
iconhelp.showname=Vis objektnavne
iconhelp.longnames=Lange objektnavne
iconhelp.obtuse=Tillad vinkler over 180°
iconhelp.solid=Ingen gennemsigtige flader
iconhelp.grid=Vis gitter
iconhelp.comment=Kommentar
iconhelp.defaults=Standardindstillinger
iconhelp.macro0=Makrodefinition
iconhelp.visual=Konstruktion med mus
iconhelp.replay=Vis konstruktion trinvis
iconhelp.oneforward=Fremad
iconhelp.fastforward=Hurtigt fremad
iconhelp.allforward=Til slutningen
iconhelp.oneback=Tilbage
iconhelp.fastback=Hurtigt tilbage
iconhelp.allback=Til start
iconhelp.close=Luk
iconhelp.area=Udfyldt polygon
iconhelp.text=Tekst med flere linjer
iconhelp.fixedcircle=Cirkel med fast radius
iconhelp.fixedangle=Vinkelben
iconhelp.fixedsegment=Linjestykke med fast længde
iconhelp.animate=Animation af punkt
iconhelp.delete=Slet objekt og afhængige objekter
iconhelp.undo=Fortryd sidste slet
iconhelp.nextbreak=Gå til næste pause
iconhelp.setbreak=Indsæt pause/slet pause
shortcuts.point=p
shortcuts.segment=s
shortcuts.line=l
shortcuts.ray=h
shortcuts.circle=c
shortcuts.intersection=x
shortcuts.move=f
shortcuts.hide=g
shortcuts.edit=r
shortcuts.tracker=i
shortcuts.objecttracker=j
shortcuts.parallel=1
shortcuts.plumb=2
shortcuts.circle3=3
shortcuts.midpoint=4
shortcuts.quadric=k
shortcuts.angle=v
shortcuts.boundedpoint=5
shortcuts.definejob=6
shortcuts.parameter=7
shortcuts.targets=8
shortcuts.runmacro=9
shortcuts.delete=Del
shortcuts.reorder=!
shortcuts.animate="
shortcuts.expression=u
shortcuts.area=a
shortcuts.text=t
shortcuts.fixedcircle=,
shortcuts.fixedangle=.
shortcuts.fixedsegment=#
shortcuts.color.0=(Ctrl-1)
shortcuts.color.1=(Ctrl-2)
shortcuts.color.2=(Ctrl-3)
shortcuts.color.3=(Ctrl-4)
shortcuts.showcolor.0=(Alt-1)
shortcuts.showcolor.1=(Alt-2)
shortcuts.showcolor.2=(Alt-3)
shortcuts.showcolor.3=(Alt-4)
shortcuts.pointtype.0=(Ctrl-5)
shortcuts.pointtype.1=(Ctrl-6)
shortcuts.pointtype.2=(Ctrl-7)
shortcuts.pointtype.3=(Ctrl-8)
shortcuts.thickness.0=(Alt-5)
shortcuts.thickness.1=(Alt-6)
shortcuts.thickness.2=(Alt-7)
menu.file=Filer
menu.file.new=Ny konstruktion
menu.file.clearmacros=Slet alle makroer
menu.file.load=Åbn konstruktion... (Ctrl-o)
menu.file.loadjob=Åbn opgave... (Ctrl-j)
menu.file.savejob=Gem som opgave... (Ctrl-k)
menu.file.save=Gem konstruktion (Ctrl-s)
menu.file.saveas=Gem som... (Ctrl-a)
menu.file.includemacros=Gem med makroer
menu.file.exit=Afslut programmet (Alt-F4)
menu.file.print=Udskriv ...
menu.file.print.isoscale=Forhold 1:1 i cm
menu.file.savebmp=Gem som bitmap (BMP) ...
menu.file.savefig=Gem grafik (som FIG) ...
menu.file.loadrun=Åbn beskrivende konstruktion (Ctrl-r)
menu.file.editrun=Rediger beskrivende konstruktion (Ctrl-x)
menu.actions=Udfør
menu.actions.elementary=Simple værktøjer
menu.actions.complex=Sammensatte værktøjer
menu.actions.fixed=Faste objekter
menu.actions.move=Værktøjer der flytter
menu.actions.decorative=Dekorative objekter
menu.options=Indstillinger
menu.options.visual=Konstruktion med mus (Ctrl-F6)
menu.options.hidden=Vis skjulte objekter (F9)
menu.options.comment=Kommentar ... (F10)
menu.options.constructiondisplay=Beskrivelse (F11)
menu.options.grid=Vis gitter (F12)
menu.options.showcolor=Vis farve
menu.options.defaultcolor=Farve
menu.options.defaultthickness=Standardbredde
menu.options.defaulttype=Vis punkt som
menu.options.setgrid=Indstil gitterbredde ...
menu.options.shownames=Vis objektnavn (Ctrl-F6)
menu.options.longnames=Lange objektnavne (Ctrl-F7)
menu.options.obtuse=Tillad vinkler over 180° (Ctrl-F12)
menu.options.solid=Ingen gennemsigtige flader
menu.options.showvalues=Vis objekters værdier (Ctrl-F8)
menu.options.partial=Delvis synlige cirkler (Ctrl-F9)
menu.options.plines=Delvis synlige linjer (Ctrl-F10)
menu.options.arrow=Linjestykker som vektorer (Ctrl-F11)
menu.options.editicons=Rediger værktøjspalet
menu.options.all=Alle
menu.options.setdigits=Decimaler ...
menu.options.back=Slet sidste objekt (<--)
menu.options.undo=Fortryd slet (Ctrl-z)
menu.zoom=Zoom
menu.zoom.in=Zoom ind (+)
menu.zoom.out=Zoom ud (-)
menu.zoom.left=Til venstre (Venstrepil)
menu.zoom.right=Til højre (Højrepil)
menu.zoom.up=Op (Pil op)
menu.zoom.down=Ned (Pil ned)
menu.macros=Makroer
menu.special.definemacro=Definer makro (Ctrl-F5)
menu.special.runmacro=Afspil makro (F5)
menu.special.savemacros=Gem makroer
menu.special.loadmacros=Åbn makroer
menu.special.deletemacros=Slet makroer
menu.special=Funktioner
menu.special.testjob=Afprøv opgave (Ctrl-F1)
menu.special.jobcomment=Opgavetekst ... (F8)
menu.special.export=Gem som HTML (Ctrl-e)
menu.special.replay=Vis konstruktion trinvis
menu.help=Hjælp
menu.help.about=Om programmet
menu.help.help=Hjælp (F1)
menu.help.browser=HTML-hjælp og demoer
menu.help.configure=Indstil browser
menu.help.text=Korte hjælpetekster
menu.help.macros=Makroer
menu.help.tools=Værktøjer
menu.help.gui=Brugerflade
menu.help.interactive=Kommandotilstand
menu.help.tips=Tips
menu.settings=Programindstillinger
menu.settings.fullicons=To fulde værktøjslinjer
menu.settings.utf=Brug UTF8-kodning (uden æ, ø, å)
menu.settings.autohide=Skjul andet skæringspunkt
menu.settings.iconbartop=Værktøjspanel øverst
menu.settings.showtips=Vis værktøjstips
menu.settings.simplegraphics=Brug enkel grafik
menu.settings.sure=Bekræft før åbne og lukke
menu.settings.pointon=Spørg før konstruktion af punkt på et objekt
menu.settings.intersection=Spørg før konstruktion af skæringspunkt
menu.settings.choice=Vis dialogen "Vælg objekt"
menu.settings.movename=Vis objektværdier mens der flyttes
menu.settings.movefixname=Faste objektværdier mens der flyttes
menu.settings.restricted=Enkle indstillinger til skolebrug
menu.colors=Angiv farver
colors.default=Standardfarver
colors.color0=Farve 1 (sort)
colors.color1=Farve 2 (grøn)
colors.color2=Farve 3 (blå)
colors.color3=Farve 4 (brun)
colors.color4=Farve 5 (turkis)
colors.color5=Farve 6 (rød)
colors.background=Baggrund
colors.select=Markering
colors.target=Mål
myfiledialog.dir=Mappe
myfiledialog.file=Filnavn
myfiledialog.pattern=Filtype
filedialog.open=Åbn
filedialog.saveas=Gem som ...
filedialog.open.action=Åbn
filedialog.saveas.action=Gem
filedialog.htmlsave=Gem som HTML
filedialog.htmlsave.action=Gem
save=Gem
load=Åbn
abort=Fortryd
bound.release=Frigør fra objekt
bound.bind=Fastgør til objekt
bound.error=Objekt ikke fundet før skæring
constructiondisplay.edit=Rediger objekt
constructiondisplay.copy=Kopier til udklipsholder
edit.Title=Egenskaber
edit.name=Navn
edit.text=Beskrivelse
edit.hidden=Skjult
edit.fixed=Fast
edit.color=Farve
edit.ok=OK
edit.cancel=Annuller
edit.showname=Vis navn
edit.point.title=Punkt
edit.point.x=X
edit.point.y=Y
edit.point.type=Type
edit.point.showvalue=Vis koordinater
edit.point.intersection=Forskellig fra
edit.point.bound=På objekt
edit.point.away=Væk fra
edit.point.close=Tæt på
edit.point.free=Frit
edit.line.title=Linje, halvlinje, linjestykke
edit.line.normal=Mellem
edit.line.thick=Bred
edit.line.thin=Smal
edit.line.type=Type
edit.circle.title=Cirkel
edit.circle.length=Radius
edit.circle.partial=Kun delvis synlig
edit.circle.range=Angiv tegnegrænser
edit.circle.killrange=Ophæv tegnegrænser
edit.point.colortype=Tykkelse
edit.segment.length=Længde
edit.segment.showvalue=Vis længde
edit.plumb.restricted=Begrænset
edit.angle.title=Vinkel
edit.angle.length=Størrelse
edit.angle.displaysize=Vis vinklens størrelse
edit.angle.normal=Normal
edit.angle.small=Lille
edit.angle.large=Stor
edit.expression.title=Udtryk
edit.expression=Beregningsudtryk
edit.expression.prompt=Beskrivelse
edit.text.title=Tekst
edit.area.title=Polygon
edit.area.back=I baggrunden
export.title=Gem som HTML
export.pagetitle=Titel på siden
export.width=Bredde
export.height=Højde
export.jar=Java-arkiv
export.comment=Brug kommentar som HTML-tekst
export.file=Konstruktionsfil
export.job=Opgave
export.color=Farve
export.backgroundcolor=Brug som baggrundsfarve
export.appletcolor=Brug som farve på applet
export.plain=Uden ramme
export.3D=Ramme
export.breaks=Afspil med pauser
export.icons=Ramme og ikoner
export.full=Ramme, ikoner og status
export.nonvisual=Ramme, ikoner og indtastningslinje
export.style=Applet-Stil
export.setcolor=Vælg farve
export.savefirst=Konstruktionen skal gemmes først
export.soltext=Løsning
export.stylesheet=CSS-fil
export.solution=Løsningsfil
export.jumpsol=Gå til løsning
export.linksol=Link til løsning
export.savesol=Gem løsningsfil
export.track=Spor
export.digits=Gem antal decimaler
export.setsize=Indsæt størrelse
export.signature=Skrevet med <a href="http://www.z-u-l.de">JavaPasser</a>
export.colors=Gem brugerdefinerede farver
export.background=Gem defineret baggrund
help.title=Hjælp
help.error=Hjælpefilen ikke fundet
help.file=schoolgeometry.txt
coloreditor.title=Juster farven
coloreditor.red=Rød
coloreditor.green=Grøn
coloreditor.blue=Blå
coloreditor.color=Brugerdefineret
comment.title=Kommentar
comment.set=OK
comment.cancel=Fortryd
comment.close=Luk
iconedit.title=Rediger værktøjspanel
iconedit.twobars=Værktøjer i to linjer
jobcomment.title=Opgave
select.title=Vælg objekt
select.ok=OK
select.cancel=Annuller
select.comment=Vis kommentar
select.all=Alle
message.circle.midpoint=Cirkel: Vælg centrum
message.circle.radius=Cirkel: Punkt på periferi (Skift: Fast radius)
message.fixedcircle.midpoint=Cirkel med fast radius: Vælg centrum
message.fixedcircle.radius=Cirkel med fast radius: Klik et sted
message.edit=Egenskaber: Vælg et objekt
message.line.first=Linje: Vælg første punkt
message.line.second=Linje: Vælg andet punkt
message.move.select=Flyt: Vælg et punkt
message.move.move=Flyt: Flyt punktet
message.point=Punkt: Afsæt et punkt
message.segment.first=Linjestykke: Vælg første punkt
message.segment.second=Linjestykke: Andet punkt (Skift: Fast længde)
message.fixedsegment.first=Linjestykke med fast længde: Første punkt
message.fixedsegment.second=Linjestykke med fast længde: Klik et sted
message.ray.first=Halvlinje: Vælg udgangspunktet
message.ray.second=Halvlinje: Vælg andet punkt
message.intersection.first=Skæringspunkt: Vælg første objekt eller skæringen
message.intersection.second=Skæringspunkt: Vælg andet objekt
message.hide=Skjul/vis: Vælg et objekt
message.tracker.select=Spor: Vælg punkt eller linje
message.tracker.selectpoint=Spor: Vælg det punkt der skal flyttes
message.tracker.move=Spor: Flyt punktet
message.objecttracker.select=Automatisk spor: Vælg et punkt eller en linje
message.objecttracker.object=Automatisk spor: Vælg en linje eller cirkel
message.objecttracker.selectpoint=Automatisk spor: Vælg det punkt der skal bevæges
message.objecttracker.selectanypoint=Automatisk spor: Vælg et andet punkt der skal bevæges
message.objecttracker.move=Automatisk spor: Bevæg punktet
message.objecttracker.start=Automatisk spor: Start animationen
message.objecttracker.stop=Automatisk spor: Stop animationen
message.parallel.first=Parallel: Vælg en linje
message.parallel.second=Parallel: Vælg et punkt
message.plumb.first=Normal: Vælg en linje
message.plumb.second=Normal: Vælg et punkt
message.circle3.first=Cirkel: Vælg første radiuspunkt
message.circle3.second=Cirkel: Vælg andet radiuspunkt
message.circle3.midpoint=Cirkel: Vælg centrum
message.midpoint.first=Midtpunkt: Vælg første punkt
message.midpoint.second=Midtpunkt: Vælg andet punkt
message.quadric=Keglesnit: Vælg punkt nummer
message.angle.first=Marker vinkel: Vælg et punkt på første ben
message.angle.root=Marker vinkel: Vælg vinkelspids
message.angle.second=Marker vinkel: Punkt på andet ben (Skift-tast: Fast størrelse)
message.fixedangle.first=Vinkelben: Vælg et punkt på første ben
message.fixedangle.root=Vinkelben: Vælg vinkelspids
message.fixedangle.second=Vinkelben: Klik et sted
message.label.select=Flyt tekst: Vælg teksten
message.label.move=Flyt tekst: Flyt teksten
message.boundedpoint=Punkt på et objekt: Vælg en linje eller cirkel
message.parameters=Makroparameter: Vælg objekter
message.targets=Makro målobjekter: Vælg objekter
message.savejob.first=Definer opgave: Vælg det sidste objekt der skal vises
message.savejob.second=Definer opgave: Vælg målobjektet
message.savejob.third=Definer opgave: Vælg hvilke andre objekter der skal vises
message.runmacro=Makro %: %. (type %) %
message.runmacro.return=(Mellemrumstast vælger %)
message.runmacro.fixes=(Skift for at vælge flere objekter)
message.delete=Slet objekt: Vælg objekt
message.reorder=Flyt objekt bagud: Vælg et objekt
message.expression=Beregningsudtryk: Vælg et sted
message.area=Udfyldt polygon: Vælg et punkt, afslut med klik på et valgt
message.text=Tekst: Vælg et sted
message.animator.point=Animation: Vælg et punkt
message.animator.segment=Animation: Vælg linjestykker eller cirkler
message.animator.running=Animation: Er i gang
message.range.first=Tegn cirkel fra punkt ...
message.range.second=... til punkt
message.setaway.away=Væk fra punktet
message.setaway.close=Hen til punktet
objectsedit.title=Rediger egenskaber
point.type.square=Kvadrat
point.type.diamond=Ruder
point.type.circle=Cirkel
point.type.dot=Prik
color.type.normal=Normal
color.type.thick=Bred
color.type.thin=Smal
text.point=Punkt i %, %
text.line=Linje gennem % og %
text.segment=Linjestykke fra % til %
text.segment.fixed=Linjestykke fra % til % med længden %
text.ray=Halvlinje fra % i retning mod %
text.intersection=Skæring mellem % og %
text.circle=Cirkel om % gennem %
text.circle.fixed=Cirkel om % gennem % med radius %
text.fixedcircle=Cirkel om % med radius %
text.circle3=Cirkel om % med radius fra % til %
text.parallel=Parallel gennem % til %
text.midpoint=Midtpunktmellem % og %
text.quadric=Keglesnit gennem %
text.plumb=Normal gennem % til %
text.angle=Marker vinkel % - % - %
text.angle.fixed=Vinkelben % - % - % med størrelsen %
text.boundedpoint=Punkt på %
text.expression=Beregningsudtryk "%" i %, %
text.area=Polygon
text.fixedangle=Vinkelben % - % med størrelsen %
name.Point=Punkt
name.Intersection=Skæring
name.OtherIntersection=Skæring
name.Circle=Cirkel
name.Circle3=Cirkel
name.Segment=Linjestykke
name.Ray=Halvlinje
name.TwoPointLine=Linje gennem to punkter
name.Line=Linje
name.Parallel=Parallel
name.Midpoint=Midtpunkt
name.Quadric=Keglesnit
name.Plumb=Normal
name.Angle=Vinkel
name.PointOn=Punkt på objekt
name.Expression=Beregningsudtryk
name.Polygon=Polygon
name.short.Point=P
name.short.Intersection=S
name.short.OtherIntersection=S
name.short.Circle=c
name.short.Circle3=c
name.short.Segment=s
name.short.Ray=h
name.short.Line=l
name.short.Parallel=p
name.short.Midpoint=M
name.short.Quadric=K
name.short.Plumb=n
name.short.Angle=v
name.short.PointOn=Pp
name.short.Expression=U
name.short.Polygon=A
prompt.point==P
prompt.pointon==P()
prompt.line==l(,)
prompt.segment==s(,)
prompt.ray==h(,)
prompt.circle==c(,)
prompt.circle3==c(,,)
prompt.intersection==S(,)
prompt.midpoint==M(,)
prompt.quadric==K(,,,,)
prompt.parallel==p(,)
prompt.plumb==n(,)
prompt.angle==v(,,)
prompt.area=A(,,)
prompt.expression=U
popup.hidden=Vis skjulte objekter
popup.replay=Gå trinvis gennem konstruktionen
popup.empty=--- Makroer ---
replay.title=Trinvis
reorder.title=Flyt objekt bagud
reorder.message=sæt ind efter
reorder.notfound=Objektet blev ikke fundet
reorder.warning=Operationen kan ikke udføres
setgrid.title=Gitterbredde
setgrid.prompt=Ny gitterbredde
setgrid.set=Sæt
definemacro.title=Makrodefinition
definemacro.name=Navn
definemacro.comment=Kommentar
definemacro.parameters=Spørg efter parametre
definemacro.noparams=Ingen parameter defineret
definemacro.nomacro=Ingen makro defineret
definemacro.targetsonly=Kun målene ses
definemacro.invisible=Skjul helt
definemacro.promptfor=Spørg efter:
macro.replace.title=Erstat makro
macro.replace=Erstat makro:
macro.replace.all=Alle
macro.usage=Forkert brug af makroen (se tips)
macro.prompt.title=Parameterangivelse
macro.prompt.prompt=Angiv en værdi for parameteren
macro.prompt.illegal=Ugyldig værdi
digits.title=Antal decimaler
digits.edit=I egenskabsdialogen
digits.lengths=Til visning
digits.angles=Til vinkler
editrun.title=Behandl konstruktionsbeskrivelsen
editrun.run=Gem og udfør
editrun.load=Anden beskrivelse
sure.title=Er du sikker?
sure.macros=Slet alle makroer?
sure.delete=Glem alle ændringer?
close.title=Luk
close.prompt=Vil du afslutte programmet?
file.exists.title=Filen findes
file.exists.overwrite=Der eksisterer allerede en fil med det navn Overskriv?
exception.nparams=Forkert antal parametre
exception.notfound=Objekt ikke fundet eller udtryk ikke defineret
exception.type=Forkert parametertype
exception.expression=Ugyldigt udtryk
exception.canfix=Objektet kan ikke låses fast
exception.fix=Forkert værdi
exception.novalue=Forkert værdi
exception.elementary=Forkert element i udtrykket
exception.bracket=Højreparentes mangler
exception.quotes=Afsluttende " mangler
exception.dot=Forkert talformat
exception.nodigit=Tallet indeholder ingen cifre
exception.function=Ukendt funktion
exception.parameter=Forkert parameter
exception.macro=Forkert makroparameter
exception.macrotarget=Forkert målobjekt
exception.name=Der skal angives et navn
exception.prompt=Forkert objekt i Spørg efter
exception.prompt.parameter=Kan ikke være en parameter
exception.parameters=Forkert parameter
exception.brackets=Fejl i parenteser
exception.job=Forkert opgaveparameter
exception.track=Forkert sporparameter
exception.animate=Forkert animationsparameter
exception.boolean=Værdien sand eller falsk var ventet
exception.value=Ugyldig værdi
exception.color=Ugyldig farve
exception.colortype=Ugyldig bredde
exception.type=Ugyldig punkttype
exception.macroparameter=Forkert makroparameter
exception.macrotarget=Forkert målobjekt
exception.double=Navnet findes allerede
error.setaway=Dette punkt er ikke defineret før skæringen
error.objecttracker.depends=Punktet er bundet til et andet objekt
constructiondisplay.title=Konstruktionsbeskrivelse
function.hide=Skjul
function.hide.short=skjul
function.rename=Navn
function.rename.short=navn
function.value=Værdi
function.value.short=værdi
function.window=Vindue
function.window.short=Vindue
function.color=Farve
function.color.short=farve
function.thickness=Bredde
function.thickness.short=bredde
function.type=Type
function.type.short=type
function.partial=delvis
function.partial.short=partiel
function.fill=Udfyldt
function.fill.short=fyldt
function.back=tilbage
function.back.short=tilb
function.away=Langtfra
function.away.short=langt
function.closeto=Hentil
function.closeto.short=hen
function.acute=Spids
function.acute.short=spids
function.obtuse=Stump
function.obtuse.short=stump
function.solid=ikke-transparent
function.solid.short=opak
function restrict=udsnit
function restrict.short=udsnit
expression.value=Værdi
parameter=Parameter
parameter.short=Param
target=mål
target.short=mål
macro=Makro
macro.short=makro
away=langtfra
away.short=fra
end=Slut
end.short=slut
invisible=Usynlig
invisible.short=usynlig
showall=Synlig
showall.short=synlig
configure.title=Angiv browser
configure.prompt=Browserkommando
background.error=Kunne ikke åbne billedet (GIF eller JPG).
menu.background=Baggrund
menu.background.grab=Gør konstruktion til baggrund
menu.background.clear=Slet baggrund
menu.background.load=Åbn baggrundsbillede ...
menu.background.tile=Side om side
menu.background.center=Centreret
menu.background.usesize=Tilpas vinduet
iconhelp.grab=Sæt eller slet baggrund
filedialog.backgroundload=Åbn baggrundsbillede
filedialog.backgroundload.action=Åbn
# New Resources in Version 2.14
menu.file.compress=Komprimér altid
menu.file.savesvg=Gem grafik (som SVG) ...
# Version 2.15
loading=Åbner konstruktion, vent venligst
# Version 2.18 and 2.19
menu.settings.font.default=Normal
menu.settings.font.bold=Fed
menu.settings.font.large=Stor
menu.file.saveeps=Gem grafik (som EPS) ...
menu.fonts=Skrifttype
# Version 2.20
bmpscaler.title=Skaler bitmap
bmpscaler.width=Bredde
bmpscaler.height=Højde
bmpscaler.scale=Faktor (tryk retur)
bmpscaler.illegal=Værdi uden for grænserne
# Version 2.21
renamemacro.title=Omdøb makro
renamemacro.name=Nyt makronavn
menu.special.renamemacro=Omdøb makro ...
# Version 2.23
savequestion.title=Gem konstruktion
savequestion.qsave=Gem ændringer?
# Version 2.25
exception.printsize=Konstruktionen kan ikke være på siden
iconhelp.nohelp=Der er ingen hjælp til dette emne
iconhelp.type?=Punkt-type
iconhelp.thickness?=Bredde
iconhelp.color?=Farve
iconhelp.filled=Udfyldt objekt
iconhelp.isback=Tegn som baggrund
iconhelp.inverse=Spejl vinklen
iconhelp.angle?=Størrelse
# Version 2.31
menu.settings.indicate=Fremhæv objekter før der vælges
menu.options.other=Andre indstillinger
menu.help.welcome=Nyt i denne version
iconhelp.twolines=Ikoner i to linjer
iconhelp.qintersection=Spørg om skæring skal konstrueres
iconhelp.qchoice=Vis dialogen "Vælg objekt"
iconhelp.qpointon=Spørg før konstruktion af punkt på objekt
iconhelp.noindicate=Fremhæv ikke objekter under markør
# Version 2.33
menu.file.new=Ny konstruktion (Ctrl-n)
# Version 2.34
edit.text.title=Rediger tekst
edit.text.settings=Tekstegenskaber
menu.settings.filedialog=Brug ikke systemets fil-dialog
# Version 2.35
menu.settings.bitmapbackground=Anvend baggrundsfarven i bitmaps
# Version 2.36
menu.file.savegraphics=Gem grafik som ...
menu.file.savepng=Gem grafik (som PNG)
bmpscaler.title=Skaler grafik
# Version 2.37
menu.file.savepdf=Gem grafik (som PDF)
iconhelp.chord=Vis som linjestykke
# Version 2.39
message.setfixedangle.first=Fastlæg vinklen: Første punkt?
message.setfixedangle.second=Fastlæg vinklen: Vinkelspids?
message.setfixedangle.third=Fastlæg vinklen: Tredje punkt?
edit.fixedangle.set=Angiv størrelse...
message.setfixedcircle.first=Angiv cirklens radius: Første punkt?
message.setfixedcircle.second=Angiv cirklens radius: Andet punkt?
edit.fixedcircle.set=Angiv størrelse...
# Version 2.40
minpointsize.title=Angiv mindste punktstørrelse
minpointsize.prompt=Angiv mindste punktstørrelse (standard: 3)
menu.settings.font.minpointsize=Mindste punktstørrelse...
# Version 2.41
name.short.Track=Tr
text.track=Spor af % mens % bevæges på %
trackquestion.keep=Behold sporet i konstruktionen?
trackquestion.title=Behold sporet
menu.options.track=Behold sporet (Skift-Enter)
iconhelp.indicate=Vis konstruktionsresultaterne før der klikkes
iconhelp.nohelp=Ingen hjælp til dette emne
# Version 2.42
objects.draw=Tegn med musen
menu.options.cleardraw=Slet tegningen (Esc)
iconhelp.draw=Tegn med musen
message.draw=Tegn med musen (Slet med ESC)
shortcuts.draw=;
# Version 2.43
message.move.select=Flyt: Vælg et punkt (skift: vis udgangsposition)
message.rename=Omdøb A,B,C,...: Vælg objekter
iconhelp.rename=Omdøb A,B,C,...
objects.rename=Omdøb A,B,C,...
shortcuts.rename=:
iconhelp.anglereduce=Vis ikke vinkelben
# Version 2.45
menu.settings.smartboard=Smartboard-modus
shortcuts.zoom=%
objects.zoom=Zoom med musen
message.zoom=Træk centret eller zoom ind og ud
# Version 2.46
menu.special.restricticons=Begrænset værktøjspanel
# Version 2.47
menu.settings.indicate.simple=Fremhæv kun punkter før konstruktion
menu.settings.beginner=Begyndermodus
question.again=Spørg altid
# Version 2.49
definemacro.parameters=Spørg efter parametre ("=Navn" for altid at bruge dette objekt)
# Version 2.53
menu.actions.angles=Vinkler
menu.actions.circles=Cirkler
menu.actions.lines=Linjer
menu.actions.points=Punkter

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,822 @@
language=pl_
version=Wersja
homefile=index.html
homepage=http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann/java/zirkel/doc_en/
about.title=O programie C.a.R.
about.name=Szkolna geometria
about.programmed=Zaprogramowa\u0142
title=Szkolna geometria
close=Zamknij
ok=OK
cancel=Anuluj
done=Wykonano pomy\u015blnie!
message=Wiadomo\u015b\u0107
warning=Ostrze\u017cenie
yes=Tak
no=Nie
true=true
false=false
warning.nojob=To nie jest zadanie!
warning.print=Drukowanie nie powiod\u0142o si\u0119!
warning.reset=Opcja b\u0119dzie aktywna po ponownym uruchomieniu programu!
question.title=Pytanie
question.intersection=Czy utworzy\u0107 tutaj punkt przeci\u0119cia?
question.pointon=Czy utworzy\u0107 punkt na tym obiekcie?
colors.black=Czarny
colors.blue=Niebieski
colors.green=Zielony
colors.brown=Br\u0105zowy
colors.cyan=Turkusowy
colors.red=Czerwony
objects.point=Punkt
objects.segment=Odcinek
objects.line=Prosta
objects.ray=P\u00f3\u0142prosta
objects.circle=Okr\u0105g
objects.intersection=Punkt przeci\u0119cia
objects.move=Przesu\u0144 punkt
objects.hide=Ukryj obiekt
objects.edit=Edytuj punkt
objects.tracker=\u015alad punktu lub prostej
objects.objecttracker=Automatyczny \u015blad punktu lub prostej
objects.parallel=Prosta r\u00f3wnoleg\u0142a
objects.plumb=Prosta prostopad\u0142a
objects.circle3=Okr\u0105g dany przez odcinek d\u0142ugo\u015bci promienia i \u015brodek
objects.midpoint=\u015arodek odcinka
objects.quadric=Sto\u017ckowa
objects.angle=K\u0105t
objects.boundedpoint=Punkt na obiekcie
objects.parameter=Ustaw parametry makroprogramu
objects.targets=Ustaw cele makroprogramu
objects.definejob=Zdefinuj zadanie
objects.runmacro=Uruchom makroprogram
objects.delete=Usu\u0144 obiekty i im potomne
objects.reorder=Przesu\u0144 obiekty w t\u0142o
objects.animate=Animacja punktu
objects.expression=Wyra\u017cenie arytmetyczne
objects.area=Wielok\u0105t
objects.text=Tekst
objects.fixedcircle=Okr\u0105g o sta\u0142ym promieniu
objects.fixedangle=K\u0105t o sta\u0142ej mierze
objects.fixedsegment=Odcinek o sta\u0142ej d\u0142ugo\u015bci
iconhelp.point=Punkt
iconhelp.segment=Odcinek
iconhelp.line=Prosta
iconhelp.ray=P\u00f3\u0142prosta
iconhelp.circle=Okr\u0105g
iconhelp.intersection=Punkt przeci\u0119cia
iconhelp.move=Przesu\u0144 punkt
iconhelp.hide=Ukryj obiekt
iconhelp.edit=Edytuj obiekt
iconhelp.tracker=\u015alad punktu lub prostej
iconhelp.objecttracker=Automatyczny \u015blad punktu lub prostej
iconhelp.parallel=Prosta r\u00f3wnoleg\u0142a
iconhelp.plumb=Prosta prostopad\u0142a
iconhelp.circle3=Okr\u0105g dany przez odcinek d\u0142ugo\u015bci promienia i \u015brodek
iconhelp.midpoint=\u015arodek odcinka
iconhelp.quadric=Sto\u017ckowa
iconhelp.angle=K\u0105t
iconhelp.boundedpoint=Punkt na obiekcie
iconhelp.hidden=Prze\u0142\u0105cz wy\u015bwietlanie ukrytych obiekt\u00f3w
iconhelp.color=Domy\u015blny kolor obiektu
iconhelp.type=Domy\u015blny typ punktu
iconhelp.type0=Domy\u015blny typ punktu
iconhelp.thickness=Domy\u015blna grubo\u015b\u0107 obiektu
iconhelp.back=Usu\u0144 ostatni obiekt
iconhelp.thickness0=Domy\u015blna grubo\u015b\u0107 obiektu
iconhelp.partial=Cz\u0119\u015bciowo widoczne okr\u0119gi
iconhelp.plines=Cz\u0119\u015bciowo widoczne proste
iconhelp.arrow=Odcinki jako wektory
iconhelp.showcolor=Poka\u017c wybrane kolory
iconhelp.runmacro=Uruchom makroprogram
iconhelp.macro=Parametry/cele/definicja makroprogramu
iconhelp.expression=Wyra\u017cenie arytmetyczne
iconhelp.showvalue=Poka\u017c warto\u015bci obiekt\u00f3w
iconhelp.showname=Poka\u017c nazwy obiekt\u00f3w
iconhelp.obtuse=U\u017cyj k\u0105t\u00f3w wi\u0119kszych ni\u017c 180°
iconhelp.solid=Nie u\u017cywaj przezroczysto\u015bci
iconhelp.longnames=D\u0142ugie nazwy obiekt\u00f3w
iconhelp.grid=Poka\u017c siatk\u0119
iconhelp.comment=Poka\u017c komentarz do konstrukcji
iconhelp.defaults=Domy\u015blne ustawienia
iconhelp.macro0=Parametry/cele/definicja makroprogramu
iconhelp.visual=Konstrukcja wizualna
iconhelp.replay=Przeprowad\u017a ponownie konstrukcj\u0119
iconhelp.oneforward=Krok naprz\u00f3d
iconhelp.fastforward=Szybko do przodu
iconhelp.allforward=Do ko\u0144ca
iconhelp.oneback=Krok wstecz
iconhelp.fastback=Szybko do ty\u0142u
iconhelp.allback=Do pocz\u0105tku
iconhelp.close=Zamknij
iconhelp.area=Wielok\u0105t
iconhelp.text=Tekst
iconhelp.fixedcircle=Okr\u0105g o sta\u0142ym promieniu
iconhelp.fixedangle=K\u0105t o sta\u0142ej mierze
iconhelp.fixedsegment=Odcinek o sta\u0142ej d\u0142ugo\u015bci
iconhelp.animate=Animacja punktu
iconhelp.delete=Usu\u0144 obiekt i jemu potomne
iconhelp.undo=Cofnij ostatnie usuni\u0119cie
iconhelp.nextbreak=Id\u017a do nast\u0119pnego wstrzymania
iconhelp.setbreak=Prze\u0142\u0105cz wstrzymanie
menu.file=Plik
menu.file.clearmacros=Wyczy\u015b\u0107 makroprogramy
menu.file.load=Otw\u00f3rz konstrukcj\u0119... (Ctrl-o)
menu.file.loadjob=Otw\u00f3rz zadanie... (Ctrl-j)
menu.file.savejob=Zapisz jako zadanie... (Ctrl-k)
menu.file.save=Zapisz konstrukcj\u0119 (Ctrl-s)
menu.file.saveas=Zapisz konstrukcj\u0119 jako... (Ctrl-a)
menu.file.includemacros=Do\u0142\u0105cz makroprogramy do konstrukcji
menu.file.exit=Zako\u0144cz (Alt-F4)
menu.file.print=Drukuj...
menu.file.print.isoscale=Skaluj 1:1 w centymetrach
menu.file.savebmp=Zapisz grafik\u0119 jako BMP...
menu.file.savefig=Zapisz grafik\u0119 jako FIG...
menu.file.loadrun=Otw\u00f3rz konstrukcj\u0119 opisow\u0105... (Ctrl-r)
menu.file.editrun=Edytuj konstrukcj\u0119 opisow\u0105... (Ctrl-x)
menu.actions=Akcje
menu.actions.elementary=Podstawowe narz\u0119dzia
menu.actions.complex=Bardziej z\u0142o\u017cone narz\u0119dzia
menu.actions.fixed=Obiekty o sta\u0142ym parametrze
menu.actions.move=Narz\u0119dzia przesuwaj\u0105ce
menu.actions.decorative=Obiekty ozdobne
menu.options=Opcje
menu.options.visual=Tryb wizualny (Ctrl-F6)
menu.options.hidden=Poka\u017c ukryte obiekty (F9)
menu.options.comment=Komentarz do konstrukcji... (F10)
menu.options.constructiondisplay=Opis konstrukcji... (F11)
menu.options.grid=Poka\u017c siatk\u0119 (F12)
menu.options.setgrid=Ustaw g\u0119sto\u015b\u0107 siatki...
menu.options.showcolor=Poka\u017c kolor
menu.options.defaultcolor=Domy\u015blny kolor
menu.options.defaultthickness=Domy\u015blna grubo\u015b\u0107
menu.options.defaulttype=Domy\u015blny typ punktu
menu.options.all=Wszystkie
menu.options.setdigits=Ustaw precyzj\u0119 dziesi\u0119tn\u0105...
menu.options.shownames=Poka\u017c nazwy obiekt\u00f3w (Ctrl-F6)
menu.options.longnames=D\u0142ugie nazwy obiekt\u00f3w (Ctrl-F8)
menu.options.obtuse=U\u017cyj k\u0105t\u00f3w wi\u0119kszych ni\u017c 180° (Ctrl-F12)
menu.options.solid=Nie u\u017cywaj przezroczysto\u015bci
menu.options.showvalues=Poka\u017c warto\u015bci obiekt\u00f3w (Ctrl-F7)
menu.options.partial=Cz\u0119\u015bciowo widoczne okr\u0119gi (Ctrl-F9)
menu.options.plines=Cz\u0119\u015bciowo widoczne proste (Ctrl-F10)
menu.options.arrow=Strza\u0142ki (Ctrl-F11)
menu.options.editicons=Edytuj pasek narz\u0119dzi...
menu.options.back=Usu\u0144 ostatni obiekt (<-)
menu.options.undo=Cofnij ostatnie usuni\u0119cie (Ctrl-z)
menu.zoom=Powi\u0119kszenie
menu.zoom.in=Powi\u0119ksz (+)
menu.zoom.out=Pomniejsz (-)
menu.zoom.left=Przesu\u0144 w lewo (strza\u0142ka w lewo)
menu.zoom.right=Przesu\u0144 w prawo (strza\u0142ka w prawo)
menu.zoom.up=Przesu\u0144 w g\u00f3r\u0119 (strza\u0142ka w g\u00f3r\u0119)
menu.zoom.down=Przesu\u0144 w d\u00f3\u0142 (strza\u0142ka w d\u00f3\u0142)
menu.macros=Makroprogramy
menu.special.definemacro=Zdefinuj makroprogram (Ctrl-F5)
menu.special.runmacro=Uruchom makroprogram... (F5)
menu.special.savemacros=Zapisz makroprogramy...
menu.special.loadmacros=Otw\u00f3rz makroprogramy...
menu.special.deletemacros=Usu\u0144 makroprogram...
menu.special=Specjalne
menu.special.testjob=Testuj zadanie (Ctrl-F1)
menu.special.jobcomment=Tre\u015b\u0107 zadania... (F8)
menu.special.export=Eksport do pliku HTML... (Ctrl-e)
menu.special.replay=Przeprowad\u017a ponownie konstrukcj\u0119
menu.help=Pomoc
menu.help.about=O programie C.a.R....
menu.help.browser=Przegl\u0105daj pomoc i przyk\u0142ady
menu.help.text=Prosta pomoc
menu.help.configure=Konfiguruj przegl\u0105dark\u0119...
menu.help.help=Pomoc (F1)
menu.help.macros=Makroprogramy
menu.help.tools=Narz\u0119dzia
menu.help.gui=Interfejs u\u017cytkownika
menu.help.interactive=Konstrukcje opisowe
menu.help.tips=Gar\u015b\u0107 wskaz\u00f3wek
menu.settings=Ustawienia specjalne...
menu.settings.fullicons=Dwa pe\u0142ne wiersze paska narz\u0119dzi
menu.settings.utf=U\u017cyj kodowania UTF-8 (Unikod)
menu.settings.autohide=Ukrywaj drugi punkt przeci\u0119cia
menu.settings.iconbartop=Pasek narz\u0119dzi nad konstrukcj\u0105
menu.settings.showtips=Poka\u017c etykietki narz\u0119dzi
menu.settings.simplegraphics=Zawsze u\u017cywaj prostej grafiki
menu.settings.sure=Potwierdzaj porzucenie niezapisanej konstrukcji
menu.settings.pointon=Pytaj przed utworzeniem punktu na obiekcie
menu.settings.intersection=Pytaj przed utworzeniem punktu przeci\u0119cia
menu.settings.choice=Poka\u017c okno wyboru dla obiekt\u00f3w
menu.settings.movename=Poka\u017c warto\u015bci obiekt\u00f3w podczas ich przesuwania
menu.settings.movefixname=Sta\u0142e warto\u015bci obiekt\u00f3w podczas ich przesuwania
menu.settings.restricted=Tryb szkolny
menu.colors=Ustaw kolory
colors.default=U\u017cyj domy\u015blnych
colors.color0=Kolor 1 (Czarny)...
colors.color1=Kolor 2 (Zielony)...
colors.color2=Kolor 3 (Niebieski)...
colors.color3=Kolor 4 (Br\u0105zowy)...
colors.color4=Kolor 5 (Turkusowy)...
colors.color5=Kolor 6 (Czerwony)...
colors.background=Kolor t\u0142a...
colors.select=Wybierz...
colors.target=Cel...
myfiledialog.dir=Katalog
myfiledialog.file=Plik
myfiledialog.pattern=Maska
filedialog.open=Otw\u00f3rz
filedialog.saveas=Zapisz jako...
filedialog.open.action=Otw\u00f3rz
filedialog.saveas.action=Zapisz
filedialog.htmlsave=Zapisz do pliku HTML
filedialog.htmlsave.action=Zapisz
save=Zapisz
load=Otw\u00f3rz
abort=Anuluj
bound.release=Zwolnij punkt
bound.bind=Na obiekcie
bound.error=Obiekt nie zosta\u0142 znaleziony przed przeci\u0119ciem!
constructiondisplay.edit=Edytuj obiekt
constructiondisplay.copy=Kopiuj do Schowka
edit.Title=W\u0142a\u015bciwo\u015bci
edit.name=Nazwa
edit.hidden=Ukryty
edit.text=Opis
edit.fixed=Ustalony
edit.color=Kolor
edit.ok=OK
edit.cancel=Anuluj
edit.showname=Poka\u017c nazw\u0119
edit.point.title=Edytuj punkt
edit.point.type=Typ
edit.point.x=X
edit.point.y=Y
edit.point.intersection=R\u00f3\u017cny od
edit.point.showvalue=Poka\u017c wsp\u00f3\u0142rz\u0119dne
edit.point.colortype=Grubo\u015b\u0107
edit.point.bound=Na obiekcie
edit.point.away=Z dala od
edit.point.close=Blisko
edit.point.free=Swobodny
edit.line.title=Edytuj prost\u0105, p\u00f3\u0142prost\u0105 lub odcinek
edit.line.normal=Normalny
edit.line.thick=Gruby
edit.line.thin=Cienki
edit.line.type=Typ
edit.segment.length=D\u0142ugo\u015b\u0107
edit.segment.showvalue=Poka\u017c d\u0142ugo\u015b\u0107
edit.circle.title=Edytuj okr\u0105g
edit.circle.length=Promie\u0144
edit.circle.partial=Cz\u0119\u015bciowe wy\u015bwietlanie
edit.circle.range=Ustaw zakres kre\u015blenia
edit.circle.killrange=Wyczy\u015b\u0107 zakres kre\u015blenia
edit.plumb.restricted=Ograniczony
edit.angle.title=Edytuj k\u0105t
edit.angle.length=Rozmiar
edit.angle.displaysize=Wy\u015bwietlany rozmiar
edit.angle.normal=Normalny
edit.angle.small=Ma\u0142y
edit.angle.large=Du\u017cy
edit.expression.title=Edytuj wyra\u017cenie arytmetyczne
edit.expression=Wyra\u017cenie arytmetyczne
edit.expression.prompt=Wyja\u015bnienie
edit.area.title=Edytuj wielok\u0105t
edit.area.back=W tle
export.title=Eksport do pliku HTML
export.pagetitle=Tytu\u0142 strony
export.width=Szeroko\u015b\u0107
export.height=Wysoko\u015b\u0107
export.jar=Plik JAR
export.comment=Zapisz komentarz do konstrukcji
export.file=Plik konstrukcji
export.job=Wy\u015bwietl jako zadanie
export.color=Kolor
export.backgroundcolor=U\u017cyj jako t\u0142o strony
export.appletcolor=U\u017cyj jako t\u0142o appletu
export.plain=Pozbawiony dodatk\u00f3w
export.3D=Obramowanie
export.breaks=Przeprowad\u017a ponownie z wstrzymaniami
export.icons=Obramowanie i pasek narz\u0119dzi
export.full=Obramowanie, pasek narz\u0119dzi i wiersz stanu
export.nonvisual=Obramowanie, pasek narz\u0119dzi i wiersz polece\u0144
export.style=Styl appletu
export.setcolor=Wybierz kolor
export.savefirst=Plik nie zosta\u0142 zapisany!
export.soltext=Rozwi\u0105zanie
export.stylesheet=Plik kaskadowego arkusza styli (CSS)
export.solution=Plik z rozwi\u0105zaniem
export.jumpsol=Id\u017a do rozwi\u0105zania
export.linksol=Odno\u015bnik do rozwi\u0105zania
export.savesol=Zapisz plik z rozwi\u0105zaniem
export.track=\u015alad punktu
export.digits=Zapisz precyzj\u0119 dziesi\u0119tn\u0105
export.setsize=Pobierz rozmiar
export.signature=Utworzony przy u\u017cyciu <a href="http://www.z-u-l.de">C.a.R.</a>
export.colors=Zapisz zdefiniowane kolory
export.background=Zapisz zdefiniowane t\u0142o
help.title=Pomoc
help.error=Nie mo\u017cna otworzy\u0107 pliku pomocy!
help.file=schoolgeometry.txt
coloreditor.title=Edytuj kolor
coloreditor.red=Czerwony
coloreditor.green=Zielony
coloreditor.blue=Niebieski
coloreditor.color=Tw\u00f3j kolor
comment.title=Komentarz do konstrukcji
comment.set=Ustaw
comment.cancel=Anuluj
comment.close=Zamknij
iconedit.title=Edytuj pasek narz\u0119dzi
iconedit.twobars=Pasek narz\u0119dzi w dw\u00f3ch wierszach
jobcomment.title=Zadanie
select.title=Wyb\u00f3r
select.ok=OK
select.cancel=Anuluj
select.comment=Poka\u017c komentarz do konstrukcji
select.all=Wszystkie
message.circle.midpoint=Okr\u0105g: \u015arodek?
message.circle.radius=Okr\u0105g: Punkt na okr\u0119gu (Shift: ustal promie\u0144)?
message.fixedcircle.midpoint=Okr\u0105g o sta\u0142ym promieniu: \u015arodek?
message.fixedcircle.radius=Okr\u0105g o sta\u0142ym promieniu: Promie\u0144?
message.edit=Edytuj: Obiekt?
message.line.first=Prosta: Pierwszy punkt?
message.line.second=Prosta: Drugi punkt?
message.ray.first=P\u00f3\u0142prosta: Pierwszy punkt?
message.ray.second=P\u00f3\u0142prosta: Drugi punkt?
message.move.move=Przesu\u0144: Przesu\u0144 punkt!
message.point=Punkt: Postaw punkt (Shift: ustal)!
message.segment.first=Odcinek: Pierwszy punkt?
message.segment.second=Odcinek: Drugi punkt (Shift: ustal d\u0142ugo\u015b\u0107)?
message.fixedsegment.first=Odcinek o sta\u0142ej d\u0142ugo\u015bci: Pierwszy punkt?
message.fixedsegment.second=Odcinek o sta\u0142ej d\u0142ugo\u015bci: Punkt wskazuj\u0105cy kierunek?
message.intersection.first=Punkt przeci\u0119cia: Pierwszy obiekt lub punkt przeci\u0119cia?
message.intersection.second=Punkt przeci\u0119cia: Drugi obiekt?
message.hide=Poka\u017c/ukryj: Obiekt?
message.tracker.select=\u015alad: Punkt lub prosta do \u015bledzenia?
message.tracker.selectpoint=\u015alad: Punkt do przesuni\u0119cia (Shift: wi\u0119cej)?
message.tracker.move=\u015alad: Przesu\u0144 punkt!
message.objecttracker.select=Automatyczny \u015blad: Punkt do \u015bledzenia (Shift: wi\u0119cej)?
message.objecttracker.object=Automatyczny \u015blad: Prosta lub odcinek?
message.objecttracker.selectpoint=Automatyczny \u015blad: Punkt do przesuni\u0119cia?
message.objecttracker.selectanypoint=Automatyczny \u015blad: Kolejny punkt do przesuni\u0119cia?
message.objecttracker.move=Automatyczny \u015blad: Przesu\u0144 punkt!
message.objecttracker.start=Automatyczny \u015blad: Rozpocznij animacj\u0119!
message.parallel.first=Prosta r\u00f3wnoleg\u0142a: Prosta?
message.parallel.second=Prosta r\u00f3wnoleg\u0142a: Punkt?
message.plumb.first=Prosta prostopad\u0142a: Prosta?
message.plumb.second=Prosta prostopad\u0142a: Punkt?
message.circle3.first=Okr\u0105g: Pierwszy punkt wyznaczaj\u0105cy promie\u0144?
message.circle3.second=Okr\u0105g: Drugi punkt wyznaczaj\u0105cy promie\u0144?
message.circle3.midpoint=Okr\u0105g: \u015arodek?
message.midpoint.first=\u015arodek odcinka: Pierwszy punkt?
message.midpoint.second=\u015arodek odcinka: Drugi punkt?
message.quadric=Sto\u017ckowa: Punkt nr
message.angle.first=K\u0105t: Punkt pierwszego ramienia?
message.angle.root=K\u0105t: Wierzcho\u0142ek?
message.angle.second=K\u0105t: Punkt drugiego ramienia (Shift: ustal miar\u0119)?
message.fixedangle.first=K\u0105t o sta\u0142ej mierze: Punkt pierwszego ramienia?
message.fixedangle.root=K\u0105t o sta\u0142ej mierze: Wierzcho\u0142ek?
message.fixedangle.second=K\u0105t o sta\u0142ej mierze: Miara?
message.label.select=Przesu\u0144 etykiet\u0119: Etykieta?
message.label.move=Przesu\u0144 etykiet\u0119: Przesu\u0144 etykiet\u0119!
message.boundedpoint=Punkt na obiekcie: Okr\u0105g lub prosta (Shift: ustal)?
message.parameters=Parametry makroprogramu: Obiekty b\u0119d\u0105ce parametrami?
message.targets=Cele makroprogramu: Obiekty b\u0119d\u0105ce celami?
message.savejob.first=Zdefinuj zadanie: Ostatni wy\u015bwietlany obiekt?
message.savejob.second=Zdefinuj zadanie: Obiekt docelowy (Shift: nie sprawdzaj)?
message.savejob.third=Zdefinuj zadanie: Dalsze obiekty do wy\u015bwietlenia?
message.runmacro=Makroprogram %: %. (Wprowad\u017a %) %
message.runmacro.return=(Spacja wybiera %)
message.runmacro.fixes=(Shift ustala zaznaczenie)
message.delete=Usu\u0144: Obiekt?
message.reorder=Przesu\u0144 obiekty: Obiekt?
message.expression=Wyra\u017cenie arytmetyczne: Okre\u015bl po\u0142o\u017cenie!
message.area=Wielok\u0105t: Wierzcho\u0142ek?
message.text=Tekst: Okre\u015bl po\u0142o\u017cenie!
message.animator.point=Animacja: Punkt do animacji?
message.animator.segment=Animacja: Okr\u0105g lub odcinek?
message.animator.running=Animacja: W toku!
message.range.first=Ustaw zakres kre\u015blenia: Punkt pocz\u0105tkowy?
message.range.second=Ustaw zakres kre\u015blenia: Punkt ko\u0144cowy?
message.setaway.away=Z dala od tego punktu!
message.setaway.close=Blisko tego punktu!
objectsedit.title=Edytuj w\u0142a\u015bciwo\u015bci
point.type.square=Kwadrat
point.type.diamond=Romb
point.type.circle=Okr\u0105g
point.type.dot=Kropka
color.type.normal=Normalny
color.type.thick=Gruby
color.type.thin=Cienki
text.point=Punkt na wsp\u00f3\u0142rz\u0119dnych %, %
text.line=Prosta przechodz\u0105ca przez % i %
text.segment=Odcinek \u0142\u0105cz\u0105cy punkty % i %
text.segment.fixed=Odcinek \u0142\u0105cz\u0105cy punkty % i %, d\u0142ugo\u015bci %
text.ray=P\u00f3\u0142prosta wychodz\u0105ca z % i przechodz\u0105ca przez %
text.intersection=Punkt przeci\u0119cia % i %
text.circle=Okr\u0105g o \u015brodku % przechodz\u0105cy przez %
text.circle.fixed=Okr\u0105g o \u015brodku % przechodz\u0105cy przez % i promieniu %
text.fixedcircle=Okr\u0105g o \u015brodku % i promieniu %
text.circle3=Okr\u0105g o \u015brodku % i promieniu d\u0142ugo\u015bci odcinka % - %
text.parallel=Prosta r\u00f3wnoleg\u0142a do % przechodz\u0105ca przez %
text.midpoint=\u015arodek odcinka % - %
text.quadric=Sto\u017ckowa opisana na %
text.plumb=Prosta prostopad\u0142a do % przechodz\u0105ca przez %
text.angle=K\u0105t % - % - %
text.angle.fixed=K\u0105t % - % - % miary %
text.boundedpoint=Punkt na %
text.expression=Wyra\u017cenie arytmetyczne "%" na wsp\u00f3\u0142rz\u0119dnych %, %
text.area=Wielok\u0105t
text.fixedangle=K\u0105t od\u0142o\u017cony od % - % miary %
name.Point=Punkt
name.Intersection=Punkt przeci\u0119cia
name.OtherIntersection=Punkt przeci\u0119cia
name.Circle=Okr\u0105g
name.Circle3=Okr\u0105g
name.Segment=Odcinek
name.Ray=P\u00f3\u0142prosta
name.Line=Prosta
name.TwoPointLine=Prosta zadana przez dwa punkty
name.Parallel=Prosta r\u00f3wnoleg\u0142a
name.Midpoint=\u015arodek odcinka
name.Quadric=Sto\u017ckowa
name.Plumb=Prosta prostopad\u0142a
name.Angle=K\u0105t
name.PointOn=Punkt na obiekcie
name.Expression=Wyra\u017cenie arytmetyczne
name.Polygon=Wielok\u0105t
popup.hidden=Poka\u017c ukryte obiekty
popup.replay=Przeprowad\u017a ponownie konstrukcj\u0119
popup.empty=--- Makroprogramy ---
replay.title=Przeprowad\u017a ponownie
reorder.title=Przesu\u0144 obiekty
reorder.message=wstaw po
reorder.notfound=Obiekt nie zosta\u0142 znaleziony!
reorder.warning=Nie mo\u017cna tego uczyni\u0107!
setgrid.title=G\u0119sto\u015b\u0107 siatki
setgrid.prompt=Wprowad\u017a now\u0105 g\u0119sto\u015b\u0107 siatki
setgrid.set=Ustaw
definemacro.title=Zdefinuj makroprogram
definemacro.name=Nazwa
definemacro.comment=Komentarz do makroprogramu
definemacro.noparams=Makroprogram wymaga parametru!
definemacro.nomacro=Brak makroprogramu do uruchomienia!
definemacro.targetsonly=Ukryj konstrukcj\u0119
definemacro.invisible=Ukryj ca\u0142kowicie
definemacro.promptfor=\u017b\u0105daj podania warto\u015bci dla
macro.replace.title=Zast\u0105pienie makroprogramu
macro.replace=Zast\u0105p makroprogram:
macro.replace.all=Wszystkie
macro.usage=Z\u0142e u\u017cycie makroprogramu (zobacz wskaz\u00f3wki)!
macro.prompt.title=\u017b\u0105danie parametru
macro.prompt.prompt=Wprowad\u017a now\u0105 warto\u015b\u0107 parametru
macro.prompt.illegal=Niedozwolona warto\u015b\u0107!
digits.title=Ustaw precyzj\u0119 dziesi\u0119tn\u0105
digits.edit=Edytuj
digits.lengths=Wy\u015bwietl
digits.angles=K\u0105ty
editrun.title=Edytuj konstrukcj\u0119 opisow\u0105
editrun.run=Zapisz i uruchom
editrun.load=Inny opis konstrukcji
sure.title=Czy jeste\u015b pewien?
sure.macros=Usun\u0105\u0107 wszystkie makroprogramy?
sure.delete=Porzuci\u0107 wykonane zmiany?
close.title=Koniec
close.prompt=Zako\u0144czy\u0107 prac\u0119 z C.a.R.?
file.exists.title=Plik istnieje
file.exists.overwrite=Plik istnieje! Nadpisa\u0107?
exception.nparams=Niedozwolona liczba parametr\u00f3w!
exception.notfound=Obiekt nie zosta\u0142 znaleziony, lub zosta\u0142 zdefiniowany po wyra\u017ceniu!
exception.expression=Niedozwolone wyra\u017cenie!
exception.canfix=Obiekt nie mo\u017ce by\u0107 ustalony!
exception.fix=Niedozwolona warto\u015b\u0107!
exception.novalue=Niedozwolona warto\u015b\u0107!
exception.elementary=Niedozwolony element wyra\u017cenia!
exception.bracket=Brak nawiasu zamykaj\u0105cego!
exception.quotes=Brak cudzys\u0142owu zamykaj\u0105cego!
exception.dot=Dwie kropki w liczbie!
exception.nodigit=Nie znaleziono cyfry w liczbie!
exception.function=Nieznana funkcja!
exception.parameter=Niedozwolony parametr funkcji!
exception.macro=Niedozwolony parametr makroprogramu!
exception.name=Nazwa jest konieczna!
exception.job=Niedozwolone parametry zadania!
exception.track=Niedozwolone parametry \u015bladu!
exception.animate=Niedozwolone parametry animacji!
exception.boolean=Warto\u015b\u0107 logiczna musi by\u0107 r\u00f3wna true albo false!
exception.value=Niedozwolona warto\u015b\u0107!
exception.color=Niedozwolony kolor!
exception.colortype=Niedozwolona grubo\u015b\u0107!
exception.type=Niedozwolony typ obiektu!
exception.macroparameter=Niedozwolony parametr makroprogramu!
exception.macrotarget=Niedozwolony cel makroprogramu!
exception.prompt=Niedozwolony \u017c\u0105dany obiekt!
exception.prompt.parameter=\u017b\u0105dany obiekt nie mo\u017ce by\u0107 parametrem!
exception.parameters=Niedozwolony parametr!
exception.brackets=Niedozwolone nawiasy!
exception.double=Nazwa by\u0142a ju\u017c u\u017cyta!
error.setaway=Ten punkt nie zosta\u0142 zdefiniowany przed przeci\u0119ciem!
error.objecttracker.depends=Ten punkt jest na innym obiekcie!
constructiondisplay.title=Konstrukcja
function.hide=Ukryj
function.rename=Nazwa
function.value=Warto\u015b\u0107
function.window=Okno
function.color=Kolor
function.thickness=Grubo\u015b\u0107
function.type=Typ
function.partial=Cz\u0119\u015bciowo
function.fill=Wype\u0142nienie
function.back=Kolor t\u0142a
function.acute=Wypuk\u0142y
function.obtuse=Wkl\u0119s\u0142y
function.solid=Nieprzezroczysty
function restrict=Ogranicz
expression.value=Warto\u015b\u0107
configure.title=Ustaw przegl\u0105dark\u0119
configure.prompt=Polecenie przegl\u0105darki
# New Resources:
background.error=Nie mo\u017cna otworzy\u0107 obrazka (obs\u0142ugiwane s\u0105 GIF i JPEG)!
menu.background=Kolor t\u0142a
menu.background.grab=Bie\u017c\u0105cy jako t\u0142o
menu.background.clear=Wyczy\u015b\u0107 t\u0142o
menu.background.load=Otw\u00f3rz obrazek t\u0142a...
menu.background.usesize=Dopasuj rozmiarem do obrazka
menu.background.tile=Wy\u015bwietl t\u0142o s\u0105siaduj\u0105co
menu.background.center=Wycentruj t\u0142o
iconhelp.grab=Ustaw lub wyczy\u015b\u0107 t\u0142o
filedialog.backgroundload=Otw\u00f3rz t\u0142o
filedialog.backgroundload.action=Otw\u00f3rz
# New Resources in Version 2.14
menu.file.compress=Zawsze kompresuj zapisywane pliki
menu.file.savesvg=Zapisz grafik\u0119 jako SVG...
# Version 2.15
loading=\u0141adowanie, prosz\u0119 czeka\u0107!
# Version 2.18 and 2.19
menu.settings.font.default=Domy\u015blna czcionka
menu.settings.font.bold=Czcionka pogrubiona
menu.settings.font.large=Czcionka powi\u0119kszona
menu.file.saveeps=Zapisz grafik\u0119 jako EPS...
menu.fonts=Czcionka
# Version 2.20
bmpscaler.width=Szeroko\u015b\u0107
bmpscaler.height=Wysoko\u015b\u0107
bmpscaler.scale=Wsp\u00f3\u0142czynnik (naci\u015bnij Enter)
bmpscaler.illegal=Niedozwolona warto\u015b\u0107!
# Version 2.21
renamemacro.title=Zmie\u0144 nazw\u0119 makroprogramu
renamemacro.name=Nowa nazwa makroprogramu
menu.special.renamemacro=Zmie\u0144 nazw\u0119 makroprogramu...
# Version 2.23
savequestion.title=Zapisz konstrukcj\u0119
savequestion.qsave=Zapisa\u0107 zmiany?
# Version 2.25
exception.printsize=Strona za ma\u0142a dla tej konstrucji!
iconhelp.type?=Typ punktu
iconhelp.thickness?=Grubo\u015b\u0107
iconhelp.color?=Kolor
iconhelp.filled=Wype\u0142niony obiekt
iconhelp.isback=Rysuj w tle
iconhelp.inverse=K\u0105t odbity
iconhelp.angle?=Rozmiar
# Version 2.28
message.objecttracker.stop=Automatyczny \u015blad: Zatrzymaj animacj\u0119 (Shift-strza\u0142ki w bok: zmie\u0144 szybko\u015b\u0107)!
# Version 2.31
menu.settings.indicate=Pod\u015bwietlaj generowane obiekty
menu.options.other=Ustawienia
menu.help.welcome=Nowo\u015bci w bie\u017c\u0105cej wersji
iconhelp.twolines=Pasek narz\u0119dzi w dw\u00f3ch wierszach
iconhelp.qintersection=Pytaj przed utworzeniem punktu przeci\u0119cia
iconhelp.qchoice=Poka\u017c okno wyboru obiektu
iconhelp.qpointon=Pytaj przed utworzeniem punktu na obiekcie
iconhelp.noindicate=Nie pod\u015bwietlaj obiekt\u00f3w wskazanych mysz\u0105
# Version 2.33
menu.file.new=Nowa konstrukcja (Ctrl-n)
# Version 2.34
edit.text.title=Ustawienia tekstu
edit.text.settings=Dalsze ustawienia
menu.settings.filedialog=Zast\u0105p systemowe okna wyboru plik\u00f3w
# Version 2.35
menu.settings.bitmapbackground=U\u017cyj koloru t\u0142a w mapach bitowych
# Version 2.36
menu.file.savegraphics=Zapisz grafik\u0119
menu.file.savepng=Zapisz grafik\u0119 jako PNG...
bmpscaler.title=Skaluj grafik\u0119
# Version 2.37
menu.file.savepdf=Zapisz grafik\u0119 jako PDF...
iconhelp.chord=Poka\u017c jako odcinek ko\u0142owy
# Version 2.39
message.setfixedangle.first=Ustaw miar\u0119: Punkt pierwszego ramienia?
message.setfixedangle.second=Ustaw miar\u0119: Wierzcho\u0142ek?
message.setfixedangle.third=Ustaw miar\u0119: Punkt drugiego ramienia?
edit.fixedangle.set=Ustaw miar\u0119...
message.setfixedcircle.first=Ustaw promie\u0144: Pierwszy punkt?
message.setfixedcircle.second=Ustaw promie\u0144: Drugi punkt?
edit.fixedcircle.set=Ustaw promie\u0144...
# Version 2.40
minpointsize.title=Ustaw minimalny rozmiar punktu
minpointsize.prompt=Minimalny rozmiar punktu (domy\u015blnie: 3)
menu.settings.font.minpointsize=Minimalny rozmiar punktu...
# Version 2.41
name.short.Track=Tr
text.track=\u015alad % podczas gdy % przesuwa si\u0119 po %
trackquestion.keep=Zachowa\u0107 \u015blad w konstrukcji?
trackquestion.title=Zachowaj \u015blad
menu.options.track=Zachowaj \u015blad (Shift-Enter)
iconhelp.indicate=Podgl\u0105d rezultat\u00f3w konstrukcji
iconhelp.nohelp=Pomoc nie jest dost\u0119pna!
# Version 2.42
objects.draw=Rysuj mysz\u0105
menu.options.cleardraw=Wyczy\u015b\u0107 rysunek (Esc)
iconhelp.draw=Rysuj mysz\u0105
message.draw=Rysuj mysz\u0105 (Esc: wyczy\u015b\u0107)
shortcuts.draw=;
# Version 2.43
message.move.select=Przesu\u0144: Punkt (Shift: poka\u017c stare po\u0142o\u017cenie)?
message.rename=Nazwij kolejnymi literami alfabetu: Obiekt?
iconhelp.rename=Nazwij kolejnymi literami alfabetu
objects.rename=Nazwij kolejnymi literami alfabetu
shortcuts.rename=:
iconhelp.anglereduce=Nie pokazuj p\u00f3\u0142prostej wyznaczonej przez k\u0105t
# Version 2.45
menu.settings.smartboard=Tryb bia\u0142ej tablicy
shortcuts.zoom=%
objects.zoom=Przesu\u0144, powi\u0119ksz lub pomniejsz mysz\u0105
message.zoom=Przesu\u0144 przeci\u0105gaj\u0105c \u015brodek, powi\u0119ksz lub pomniejsz przeci\u0105gaj\u0105c obrze\u017ce konstrukcji
# Version 2.46
menu.special.restricticons=Ograniczony pasek narz\u0119dzi
# Version 2.47
menu.settings.indicate.simple=Pokazuj przy podgl\u0105dzie tylko punkty
menu.settings.beginner=Tryb dla pocz\u0105tkuj\u0105cych
question.again=Zawsze zadawaj to pytanie
# Version 2.49
definemacro.parameters=\u017b\u0105danie parametr\u00f3w (podanie "=nazwy" obiektu ustala go)
# Version 2.53
menu.actions.angles=K\u0105ty
menu.actions.circles=Okr\u0119gi
menu.actions.lines=Proste, p\u00f3\u0142proste i odcinki
menu.actions.points=Punkty
# Version 3.00
info.title=Pomoc kontekstowa
info.related=Tematy pokrewne
info.notfound=Temat nie zost\u0105\u0142 znaleziony!
info.noresults=Szukany tekst nie zosta\u0142 znaleziony!
info.searchresults=- Wyniki wyszukiwania -
info.select=- Wybierz -
info.search=Szukaj
info.back=Wstecz
info.start=Start
iconhelp.info=Pomoc kontekstowa
menu.help.info=Pomoc kontekstowa
myfiledialog.homedir=Katalog C.a.R.
myfiledialog.windowshome=Moje dokumenty
myfiledialog.mkdir=Utw\u00f3rz katalog
myfiledialog.back=Wstecz
menu.file.alwaysclearmacros=Wyczy\u015b\u0107 makroprogramy przy otwarciu konstrukcji
about.language=J\u0119zyk
bmpscaler.72dpi=72 dpi
bmpscaler.300dpi=300 dpi
# Version 3.01
menu.settings.backups=Zapisuj z kopi\u0105 zapasow\u0105
# Version 3.02
menu.options.hideduplicates=Ukryj duplikaty
# Version 3.03
menu.options.function=Wykres funkcji...
text.function=Funkcja f(%)=%
function.varmin=Od
function.varmax=Do
function.dvar=Krok
function.var=Zmienna
function.x=X
function.y=Y
iconhelp.function=Wykres funkcji
menu.options.editlast=Edytuj ostatni obiekt...
iconhelp.control.edit=Edytuj ostatni obiekt
iconhelp.control.hide=Ukryj duplikaty
edit.function.title=Wykres funkcji lub krzywa
iconhelp.control.runmacro=Uruchom ponownie ostatni makroprogram
# Version 3.05
point.type.cross=Krzy\u017cyk
point.type.dcross=Uko\u015bny krzy\u017cyk
shortcuts.pointtype.4=(Ctrl-9)
shortcuts.pointtype.5=(Ctrl-0)
edit.unit=Jednostka
menu.special.break=Punkty przerwania
menu.bp.setbreak=Ustaw punkt przerwania
menu.bp.clearbreak=Usu\u0144 punkt przerwania
menu.bp.sethidingbreak=Ustaw ukrywaj\u0105cy punkt przerwania
menu.bp.animatebreak=Animuj punkty przerwania
iconhelp.animatebreak=Animuj punkty przerwania
message.animatebreak=Animuj punkty przerwania: Zatrzymaj animacj\u0119 (Shift-strza\u0142ki w bok: zmie\u0144 szybko\u015b\u0107)!
menu.special.exporttemplate=Eksport do pliku HTML przy u\u017cyciu szablonu...
templateload.open=Otw\u00f3rz szablon
templateload.open.action=Otw\u00f3rz
menu.settings.doubleclick=Podw\u00f3jne klikni\u0119cie wy\u015bwietla makroprogramy

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,921 @@
abort=Huy bo
about.language=Ngon ngu
about.name=School Geometry
about.programmed=Lap trinh boi
about.title=Thong tin chuong trinh
arrowsize.prompt=Kich thuoc dang mui ten (mac dinh: 10)
background.error=Khong the mo tap tin anh (.GIF hoac .JPG).
bmpscaler.300dpi=300 dpi
bmpscaler.72dpi=72 dpi
bmpscaler.height=Chieu cao
bmpscaler.illegal=Gia tri khong hop le
bmpscaler.scale=Thua so
bmpscaler.title=Co gian anh
bmpscaler.width=Chieu rong
bound.bind=Lien ket den doi tuong
bound.error=Doi tuong khong the thiet lap!
bound.release=Giai phong diem
cancel=Huy bo
clip.height=Chieu cao
clip.screen=No Clipping
clip.title=Set Clipping
clip.width=Chieu rong
close=Dong
close.prompt=Ban co that su muon thoat khoi chuong trinh?
close.title=Ket thuc
color.type.invisible=An
color.type.normal=Binh thuong
color.type.thick=Day
color.type.thin=Mong
coloreditor.blue=Xanh duong
coloreditor.color=Mau sac
coloreditor.green=Xanh la cay
coloreditor.red=Do
coloreditor.title=Chinh sua mau sac
colors.background=Mau nen
colors.black=Den
colors.blue=Xanh duong
colors.brown=Nau
colors.color0=Mau 1 (Den)
colors.color1=Mau 2 (Xanh la cay)
colors.color2=Mau 3 (Xanh duong)
colors.color3=Mau 4 (Nau)
colors.color4=Mau 5 (Xanh lam)
colors.color5=Mau 6 (Do)
colors.cyan=Xanh lam
colors.default=Su dung mau mac dinh
colors.green=Xanh la cay
colors.red=Do
colors.select=Tuy chon
colors.target=Target
comment.cancel=Huy bo
comment.close=Dong
comment.set=Thiet lap
comment.title=Ghi chu
configure.prompt=Nhap vao ten trinh duyet Web va dia chi trang web cua chuong trinh
configure.title=Thiet lap trinh duyet Web
constructiondisplay.all=Tat ca doi tuong
constructiondisplay.angles=Goc
constructiondisplay.circles=Hinh tron
constructiondisplay.copy=Sao chep toi bo nho tam
constructiondisplay.delete=Xoa doi tuong
constructiondisplay.edit=Chinh sua doi tuong
constructiondisplay.editconditions=Chinh sua co dieu kien
constructiondisplay.expressions=Bieu thuc
constructiondisplay.hide=An/Hien doi tuong
constructiondisplay.invalid=Doi tuong khong hop le
constructiondisplay.lines=Duong thang
constructiondisplay.other=Nhung doi tuong khac
constructiondisplay.points=Diem
constructiondisplay.select=Tuy chon
constructiondisplay.sorted=Sap xep doi tuong theo thu tu dung hinh
constructiondisplay.superhide=Sieu an
constructiondisplay.title=Dung hinh
constructiondisplay.visible=Khong hien thi doi tuong an
date=Build
definemacro.comment=Ghi chu trong Macro
definemacro.invisible=An thanh cong
definemacro.name=Ten
definemacro.nomacro=Khong the chay Macro!
definemacro.noparams=Tham so can thiet cho Macro!
definemacro.parameters=Dau nhac tham so("=ten")
definemacro.promptfor=Dau nhac thay the cho
definemacro.targetsonly=An su dung hinh
definemacro.title=Dinh nghia Macro
digits.angles=Goc
digits.edit=Chinh sua
digits.lengths=Hien thi
digits.title=Thiet lap hien thi phan thap phan
done=Dung!
edit.Title=Thuoc tinh
edit.alias=Ten hieu
edit.angle.displaysize=Hien thi do lon
edit.angle.large=Lon
edit.angle.length=Do lon
edit.angle.normal=Trung binh
edit.angle.small=Nho
edit.angle.title=Chinh sua goc
edit.area.area=Pham vi
edit.area.back=Trong hinh nen
edit.area.title=Chinh sua hinh da giac
edit.cancel=Huy bo
edit.circle.bounds=Hien thi cung
edit.circle.length=Ban kinh
edit.circle.partial=Hien thi
edit.circle.range=Thiet lap cung...
edit.circle.title=Chinh sua hinh tron
edit.color=Mau sac
edit.discrete=Roi rac
edit.equation=Phuong trinh
edit.expression=Bieu thuc
edit.expression.prompt=Loi giai thich
edit.expression.slider=Hien thi con truot
edit.expression.title=Chinh sua bieu thuc
edit.fixed=Co dinh vi tri
edit.fixedangle.set=Thiet lap kich thuoc
edit.fixedcircle.set=Thiet lap do lon
edit.function.center=Ham so trung voi truc x
edit.function.free=Release Center
edit.function.title=Ham so hoac duong cong
edit.hidden=An
edit.intersection.alternate=Co the luan phien
edit.line.invisible=An
edit.line.normal=Binh thuong
edit.line.thick=Day
edit.line.thin=Mong
edit.line.title=Chinh sua
edit.line.type=Kieu
edit.name=Ten
edit.ok=Dong y
edit.plumb.restricted=Gioi han
edit.point.away=Xa
edit.point.bound=Thuoc doi tuong
edit.point.close=Close to
edit.point.colortype=Day
edit.point.free=Free
edit.point.intersection=Tach ra tu`
edit.point.showvalue=Hien thi toa do
edit.point.title=Chinh sua diem
edit.point.type=Kieu
edit.point.x=x
edit.point.y=y
edit.segment.length=Do dai
edit.segment.showvalue=Hien thi do dai
edit.showname=Hien thi ten
edit.text=Ghi chu
edit.text.settings=Tuy chon
edit.text.title=Thiet lap ghi chu
edit.track.dmin=Minimal step (default 0.001)
edit.unit=Don vi
editconditionals.background=Hinh nen
editconditionals.hidden=An
editconditionals.showname=Hien thi ten
editconditionals.showvalue=Hien thi gia tri
editconditionals.solid=Not Transparent
editconditionals.superhidden=An thanh cong
editconditionals.title=Chinh sua co dieu kien
editconditionals.visible=Binh thuong
editconditionals.z=Z-Buffer Value
editrun.load=Mieu ta khac
editrun.run=Luu va chay
editrun.title=Chinh sua mieu ta cach dung hinh
error.depends=Doi tuong % phu thuoc vao doi tuong hien hanh
error.fixedsegment=Khong the co dinh doan thang nay!
error.image=Image not in same folder as construction?
error.objecttracker.depends=The point is bound to another object!
error.setaway=This point is not defined before the intersection!
exception.animate=Thong so chay hieu ung khong hop le!
exception.boolean=Boolean Value must be true of false!
exception.bracket=Thieu dau dong ngoac!
exception.brackets=Dau ngoac khong hop le!
exception.canfix=Doi tuong nay khong the co dinh!
exception.clipboardcopy=Sao chep khong thanh cong!
exception.color=Mau sac khong hop le!
exception.colortype=Do day khong hop le!
exception.depends=Doi tuong % phu thuoc vao doi tuong hien hanh
exception.dot=Two dots in number!
exception.double=Name is not unique!
exception.elementary=Phan tu khong hop le trong bieu thuc!
exception.expression=Bieu thuc khong hop le!
exception.fix=Gia tri khong hop le!
exception.function=Ham so khong hop le!
exception.job=Thong so tinh toan khong hop le!
exception.macro=Thong so macro khong hop le!
exception.macroparameter=Thong so Macro khong hop le!
exception.macrotarget=Illegal Macro Target!
exception.name=Thieu ten!
exception.nodigit=No digit found in number!
exception.notfound=Doi tuong khong the thiet lap hoac chua duoc dinh nghia!
exception.novalue=Gia tri khong hop le!
exception.nparams=Thong so khong hop le cua tham so!
exception.parameter=Thong so cua ham khong hop le!
exception.parameters=Thong so khong hop le!
exception.printsize=Trang giay nay qua nho de dung hinh!
exception.prompt=Illegal prompt oject!
exception.prompt.parameter=Prompt object may not be a parameter!
exception.quotes=Closing quotes missing!
exception.superfluous=Bieu thuc khong hop le!
exception.track=Illegal Track Parameters!
exception.type=Kieu hien thi diem khong hop le!
exception.value=Gia tri khong hop le!
export.3D=Duong vien
export.appletcolor=Use for applet background
export.background=Save defined Background
export.backgroundcolor=Use for page background
export.breaks=Xem lai tai nhung diem dung
export.codebase=Codebase
export.color=Mau sac
export.colors=Luu mau sac dinh nghia
export.comment=Luu ghi chu
export.digits=Luu ky so
export.file=Construction File
export.full=Duong vien, bieu tuong va trang thai
export.height=Chieu cao
export.icons=Duong vien va bieu tuong
export.jar=Tap tin Jar
export.job=Display as Assignment
export.jumpsol=Jump to Solution
export.linksol=Link to Solution
export.nonvisual=Duong vien, Icons va Duong thang bat dau
export.pagetitle=Tieu de cua trang
export.plain=Don gian
export.popup=Hien thi thanh Menu
export.restrictedmove=Han che su di chuyen
export.savefirst=Tap tin nay khong the luu!
export.savesol=Save Solution File
export.setcolor=Chon mau sac
export.setsize=Get Size
export.signature=Created with C.a.R. by <a href="http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann">R. Grothmann</a>
export.soltext=Solution
export.solution=Solution File
export.style=Applet Style
export.stylesheet=Tap tin kieu CSS
export.title=Xuat ra thanh dang tap tin HTML
export.track=Track Point
export.width=Chieu rong
export.zoom=Phong to / thu nho voi chuot
expression.value=Gia tri
false=Sai
file.exists.overwrite=Tap tin dang ton tai! Ban co muon thay doi tren tap tin nay?
file.exists.title=Tap tin dang ton tai
filedialog.backgroundload=Tai hinh nen
filedialog.backgroundload.action=Tai
filedialog.htmlsave=Luu thanh dang HTML
filedialog.htmlsave.action=Luu
filedialog.imageload=Tai hinh
filedialog.imageload.action=Tai
filedialog.open=Mo
filedialog.open.action=Mo
filedialog.saveas=Luu voi ten khac...
filedialog.saveas.action=Luu
function=restrict.short=restrict
function.acute=Goc nhon
function.acute.short=Goc nhon
function.back=Hinh nen
function.back.short=Quay lai
function.color=Mau sac
function.color.short=Mau sac
function.dvar=Step
function.fill=Fill
function.fill.short=fill
function.hide=An
function.hide.short=An
function.obtuse=Goc tu
function.obtuse.short=Goc tu
function.partial=Partial
function.partial.short=part
function.rename=Ten
function.rename.short=Ten
function.solid=Solid
function.solid.short=solid
function.thickness=Day
function.thickness.short=Day
function.type=Kieu
function.type.short=Kieu
function.value=Gia tri
function.value.short=Gia tri
function.var=Bien so
function.varmax=Den
function.varmin=Tu
function.window=Cua so
function.window.short=Cua so
function.x=Gia tri cua x
function.y=Gia tri cua y
help=Tro giup
help.error=Khong the mo tap tin tro giup!
help.file=schoolgeometry.txt
help.title=Tro giup
homefile=index.html
homepage=http://www.z-u-l.de/
iconbar.showseparators=Hien thi dang phan cat
iconedit.showseparators=Hien thi dang phan cat
iconedit.title=Chinh sua thanh cong cu
iconedit.twobars=Hien thi day du thanh cong cu
iconhelp.allback=To the start
iconhelp.allforward=To the end
iconhelp.angle=Goc (a)
iconhelp.angle?=Do lon
iconhelp.anglereduce=Don't show angle ray
iconhelp.animate=Hieu ung (")
iconhelp.animatebreak=Animate breakpoints
iconhelp.area=Hinh da giac (0)
iconhelp.arrow=Tao doan thang theo dang hinh mui ten (Ctrl-F11)
iconhelp.back=Xoa doi tuong cuoi (<-)
iconhelp.bold=Hien thi font chu dam
iconhelp.boundedpoint=Diem thuoc doi tuong (5)+Shift: Khong co dinh doi tuong
iconhelp.chord=Hien thi doan thang
iconhelp.circle=Hinh tron (c)
iconhelp.circle3=Hinh tron tu 3 diem (3)
iconhelp.close=Dong
iconhelp.color=Thiet lap mau sac mac dinh cua doi tuong (Ctrl-1,2,3,4)
iconhelp.color?=Mau sac
iconhelp.comment=Hien thi va chinh sua ghi chu (F10)
iconhelp.control.edit=Chinh sua doi tuong cuoi
iconhelp.control.hide=An ban sao
iconhelp.control.runmacro=Chay lai Macro cuoi
iconhelp.defaults=Thiet lap mac dinh
iconhelp.delete=Xoa doi tuong va doi tuong con cua no (Del)
iconhelp.draw=Ve voi chuot
iconhelp.edit=Chinh sua doi tuong (e)+Shift: Chinh sua nhieu doi tuong+Ctrl: Chinh sua doi tuong cuoi
iconhelp.expression=Bieu thuc so hoc (x)
iconhelp.fastback=Quay lai nhanh
iconhelp.fastforward=Tien toi nhanh
iconhelp.filled=Filled object
iconhelp.fixedangle=Goc voi do lon co dinh (.)
iconhelp.fixedcircle=Hinh tron voi ban kinh co dinh (,)
iconhelp.fixedsegment=Doan thang voi do dai co dinh (#)
iconhelp.function=Tao ham so
iconhelp.grab=Huy bo hinh nen
iconhelp.grid=Hien thi he truc toa do - dang luoi (F12)
iconhelp.hidden=Hien / An doi tuong (F9)
iconhelp.hide=An doi tuong (h)
iconhelp.image=Tai hinh (_)
iconhelp.indicate=Xem truoc ket qua dung hinh
iconhelp.info=Noi dung tro giup
iconhelp.intersection=Giao diem (i)
iconhelp.inverse=Goc doi xung
iconhelp.isback=Draws in background
iconhelp.large=Hien thi font chu lon
iconhelp.line=Duong thang (g)
iconhelp.load=Mo tap tin... (Ctrl-o)
iconhelp.longnames=Hien thi ten day du cua doi tuong (Ctrl-F8)
iconhelp.macro=Thiet lap thong so Macro, muc dich va dinh nghia (7,8,Ctrl-5)
iconhelp.macro0=Thiet lap thong so Macro, muc dich va dinh nghia
iconhelp.midpoint=Trung diem (4)
iconhelp.move=Di chuyen diem (m)+Ctrl(Diem): Hien thi vi tri ban dau cua diem+Ctrl: Di chuyen doi tuong co dinh+Shift: Di chuyen nhieu doi tuong
iconhelp.new=Tao moi (Ctrl-n)
iconhelp.nextbreak=Jump to next break
iconhelp.nohelp=Phan nay khong co trong tro giup!
iconhelp.noindicate=Do not indicate objects under mouse
iconhelp.objecttracker=Automatic track of a point or a line (o)+Strg: Keep Track (Shift-Enter)
iconhelp.obtuse=Tao goc lon hon 1800 (Ctrl-F12)
iconhelp.oneback=Quay lai
iconhelp.oneforward=Tien toi
iconhelp.parallel=Duong thang song song (1)
iconhelp.partial=Hien thi mac dinh 1 phan hinh tron (Ctrl-F9)
iconhelp.plines=Hien thi mac dinh 1 phan duong thang (Ctrl-F10)
iconhelp.plumb=Duong thang vuong goc (2)
iconhelp.point=Diem (p)
iconhelp.qchoice=Show dialog for object selection
iconhelp.qintersection=Ask for intersections
iconhelp.qpointon=Ask to create point on object
iconhelp.quadric=Duong Conic di qua 5 diem ($)
iconhelp.ray=Tia (r)
iconhelp.rename=Doi ten moi A,B,C,...
iconhelp.replay=Xem lai viec dung hinh
iconhelp.runmacro=Chay Macro (9)+Ctrl: Chay Macro cuoi
iconhelp.save=Luu tap tin (Ctrl-s)
iconhelp.segment=Doan thang (s)
iconhelp.setbreak=Toggle break+Shift: Hidden breakpoint
iconhelp.showcolor=Mau sac doi tuong (Alt-1,2,3,4)
iconhelp.showname=Hien thi ten mac dinh cua doi tuong (Ctrl-F6)
iconhelp.showvalue=Hien thi toa do cua doi tuong (Ctrl-F7)
iconhelp.solid=Do not use transparency by default
iconhelp.text=Ghi chu tren nhieu dong (b)
iconhelp.thickness=Thiet lap muc do day mong cho doi tuong (Alt-5,6,7)
iconhelp.thickness0=Mong
iconhelp.thickness?=Day
iconhelp.tracker=Track a point or a line (t)
iconhelp.twolines=Hien thi day du thanh cong cu
iconhelp.type=Thiet lap kieu hien thi diem (Ctrl-5,6,7,8,9,0)
iconhelp.type0=Thiet lap kieu hien thi diem
iconhelp.type?=Kieu diem
iconhelp.undo=Huy bo thao tac cuoi vua thuc hien (Ctrl-z)
iconhelp.visual=Toggle visual construction mode
iconhelp.zoom=Phong to / thu nho voi chuot (%)
info.back=Quay lai
info.noresults=Chuoi khong the thiet lap!
info.notfound=Chu de khong the thiet lap!
info.related=Nhung chu de co lien quan
info.search=Tim kiem
info.searchresults=- Ket qua tim kiem -
info.select=- Tuy chon -
info.start=Bat dau
info.title=Noi dung tro giup
jobcomment.title=Assignment
language.prompt=Ngon ngu bat dau khi chay chuong tring
language.title=Thiet lap ngon ngu
latexsettings.boundingbox=Create Bounding box bb-file
latexsettings.dollar=LaTeX does $...$
latexsettings.doubledollar=LaTeX does $$...$$
latexsettings.fullpath=Duong dan cua tap tin
latexsettings.latexinput=Tao tap tin LaTeX
latexsettings.nodollar=LaTeX does all other strings
latexsettings.title=Setup LaTeX export
load=Tai
loading=Dang tai, vui long cho!
macro.prompt.illegal=Gia tri khong hop le!
macro.prompt.prompt=Nh\u1eadp 1 gia tri v`o tham so
macro.prompt.title=Parameter Prompt
macro.replace=Thay the Macro:
macro.replace.all=Tat ca
macro.replace.title=Macro duoc thay the
macro.usage=Wrong use of macro (see tips)!
menu.actions=Chinh sua
menu.actions.angles=Goc
menu.actions.circles=Hinh tron
menu.actions.complex=Nhung cong cu nang cao
menu.actions.decorative=Nhung doi tuong phu
menu.actions.elementary=Nhung cong cu co ban
menu.actions.lines=Duong thang
menu.actions.move=Di chuyen
menu.actions.points=Diem
menu.background=Hinh nen
menu.background.center=Canh giua hinh nen
menu.background.clear=Xoa bo hinh nen
menu.background.grab=Hinh nen hien tai
menu.background.load=Tai hinh nen...
menu.background.tile=Hien thi dang xep ke nhau
menu.background.usesize=Tro lai kich thuoc ban dau cua hinh
menu.background.usewidth=Dieu chinh chieu cao thich hop
menu.bp.animatebreak=Animate Breakpoints
menu.bp.clearbreak=Xoa tat ca diem ngat
menu.bp.setbreak=Thiet lap diem ngat
menu.bp.sethidingbreak=Thiet lap an diem ngat
menu.colors=Thiet lap mau sac
menu.file=Tap tin
menu.file.alwaysclearmacros=Clear Macros before Loading
menu.file.clearmacros=Xoa tat ca Macro
menu.file.clip=Clip for Graphics Output...
menu.file.compress=Nen tap tin khi luu
menu.file.copypng=Luu vao bo nho tam
menu.file.editrun=Chinh sua tap tin *.run (Ctrl-x)
menu.file.exit=Thoat (Alt-F4)
menu.file.includemacros=Tat ca Macro
menu.file.load=Mo tap tin... (Ctrl-o)
menu.file.loadjob=Mo tap tin *.job,*.jobz... (Ctrl-j)
menu.file.loadrun=Mo tap tin *.run... (Ctrl-r)
menu.file.new=Tao moi (Ctrl-n)
menu.file.print=In...
menu.file.print.isoscale=Co dan 1:1 theo cm
menu.file.save=Luu tap tin (Ctrl-s)
menu.file.saveas=Luu voi ten moi... (Ctrl-a)
menu.file.savebmp=Luu thanh dang BMP...
menu.file.saveeps=Luu thanh dang EPS...
menu.file.savefig=Luu thanh dang FIG...
menu.file.savegraphics=Luu tap tin thanh dang...
menu.file.savejob=Save as Assignment... (Ctrl-k)
menu.file.savepdf=Luu thanh dang PDF
menu.file.savepng=Luu tap tin thanh dang PNG
menu.file.savesvg=Luu thanh dang SVG...
menu.fonts=Font chu
menu.grid.options=Tuy chon hien thi dang luoi
menu.help=Tro giup
menu.help.about=Thong tin chuong trinh
menu.help.browser=Xem tro giup va demo tren trang web
menu.help.configure=Configure the Browser
menu.help.gui=Giao dien nguoi dung
menu.help.help=Tro giup (F1)
menu.help.info=Muc luc tro giup
menu.help.interactive=Descriptive Constructions
menu.help.macros=About Macros
menu.help.text=Tro giup nhanh
menu.help.tips=Mot vai thu thuat
menu.help.tools=The Tools
menu.help.welcome=Thong tin ve phien ban hien hanh
menu.macros=Macro
menu.moresettings=Thiet lap
menu.options=Tuy chon
menu.options.all=Tat ca
menu.options.arrow=Tao doan thang theo dang hinh mui ten (Ctrl-F11)
menu.options.back=Xoa doi tuong cuoi (<-)
menu.options.boldfont=Font chu dam
menu.options.cleardraw=Huy bo thao tac ve (Esc)
menu.options.comment=Chinh sua ghi cu (F10)
menu.options.constructiondisplay=Hien thi mo ta
menu.options.defaultcolor=Mau sac mac dinh
menu.options.defaultthickness=Do day mac dinh
menu.options.defaulttype=Kieu diem mac dinh
menu.options.editicons=Chinh sua thanh cong cu
menu.options.editlast=Chinh sua doi tuong cuoi
menu.options.export=Thiet lap hien thi
menu.options.exportsettings=Nhung thiet lap danh rieng...
menu.options.finegrid=Hien thi he truc toa do
menu.options.function=Tao ham so
menu.options.grid=Hien thi he truc toa do - dang luoi (F12)
menu.options.hidden=Hien / An nhung doi tuong an
menu.options.hideduplicates=An ban sao cua doi tuong
menu.options.largefont=Kich thuoc font lon
menu.options.leftsnap=Snap with Left Button Drag
menu.options.longnames=Hien thi ten day du cua doi tuong
menu.options.minfontsize=Kich thuoc font nho
menu.options.minpointsize=Kich thuoc diem nho
menu.options.obtuse=Tao goc lon hon 1800 (Ctrl-F12)
menu.options.other=Thiet lap
menu.options.partial=Tao hinh tron mac dinh hien thi 1 phan (Ctrl-F9)
menu.options.plines=Tao duong thang mac dinh hien thi 1 phan (Ctrl-F10)
menu.options.printscalepreview=Xem truoc khi in (Ctrl-F3)
menu.options.printscaler=Thiet lap kich thuoc...
menu.options.restricted=Gioi han giao diem
menu.options.setdigits=Thiet lap hien thi phan thap phan
menu.options.setgrid=Set Grid Width...
menu.options.showcolor=Hien thi mau sac
menu.options.shownames=Hien thi ten doi tuong (Ctrl-F6)
menu.options.showvalues=Hien thi gia tri doi tuong (Ctrl-F7)
menu.options.sizes=Thiet lap kich thuoc...
menu.options.solid=Do not use Transparency
menu.options.track=Keep Track (Shift-Enter)
menu.options.undo=Huy bo thao tac xoa vua thuc hien (Ctrl-z)
menu.options.visual=Chuc nang tao doi tuong bang chuot
menu.settings=Nhung thiet lap danh rieng
menu.settings.autohide=Hide second Intersection Point
menu.settings.backups=Luu tru du phong
menu.settings.beginner=Giao dien mac dinh
menu.settings.bitmapbackground=Su dung mau nen trong Bitmaps
menu.settings.boundingbox=Create Bounding Box (bb) file
menu.settings.choice=Show selection Dialog for Objects
menu.settings.constructiondisplay=Hien thi dang sach doi tuong (F11)
menu.settings.doubleclick=Nhap 2 lan phai chuot de tao Macro
menu.settings.filedialog=Replace system file dialog
menu.settings.font.bold=Font chu dam
menu.settings.font.default=Font chu mac dinh
menu.settings.font.large=Font chu lon
menu.settings.fullicons=Use two full Icon Bars
menu.settings.iconbartop=Hien thi thanh cong cu nam phia tren
menu.settings.indicate=Hien thi nhung doi tuong tu dong phat sinh
menu.settings.indicate.simple=Khong hien thi truoc ket qua hinh ve
menu.settings.intersection=Ask before creating an Intersection
menu.settings.language=Thiet lap ngon ngu
menu.settings.minfontsize=Kich thuoc font chu toi thieu
menu.settings.minpointsize=Kich thuoc diem toi thieu
menu.settings.minwidth=Do day duong thang la 1
menu.settings.movefixname=Hien thi gia tri doi tuong co dinh khi di chuyen
menu.settings.movename=Hien thi gia tri doi tuong khi di chuyen
menu.settings.oldicons=Hien thi dang bieu tuong cu
menu.settings.pointon=Ask before creating a Point on an Object
menu.settings.restricted=Nhung chuc nang don gian
menu.settings.scalepdf=Scale PDF and EPS output 1:1
menu.settings.showtips=Hien thi chu thich cong cu
menu.settings.simplegraphics=Giam do min cho hinh ve
menu.settings.smallicons=Hien thi dang bieu tuong nho
menu.settings.smartboard=Smartboard Mode
menu.settings.squarepoints=Draw points always as squares
menu.settings.sure=Confirm before Loading and Closing
menu.settings.utf=Su dung ma UTF-8
menu.special=Special
menu.special.break=Diem ngat
menu.special.definemacro=Dinh nghia 1 Macro (Ctrl-F5)
menu.special.deletemacros=Xoa Macro...
menu.special.export=Luu tap tin thanh dang HTML... (Ctrl-e)
menu.special.exporttemplate=Xuat tap tin HTML thanh dang mau
menu.special.jobcomment=Set Assignment Text... (F8)
menu.special.loadmacros=Tai Macro...
menu.special.renamemacro=Doi ten Macro...
menu.special.replay=Xem lai cach dung hinh do
menu.special.restricticons=Gioi han thanh cong cu
menu.special.runmacro=Chay 1 Macro... (F5)
menu.special.savemacros=Luu Macro...
menu.special.testjob=Test this Assignment (Ctrl-F1)
menu.zoom=Phong to / Thu nho
menu.zoom.down=Di chuyen xuong duoi (Nut di chuyen xuong)
menu.zoom.in=Phong to (+)
menu.zoom.left=Di chuyen qua ben trai (Nut di chuyen qua trai )
menu.zoom.out=Thu nho (-)
menu.zoom.right=Di chuyen qua ben phai (Nut di chuyen qua phai)
menu.zoom.up=Di chuyen len tren (Nut di chuyen len tren)
message=Thong bao
message.angle.first=Goc: Diem thu nhat?
message.angle.root=Goc: Dinh goc ?
message.angle.second=Goc: Diem thu hai (Shift: Co dinh kich thuoc)?
message.animatebreak=Animate breakpoints: click to stop (shift left/right for speed)!
message.animator.point=Hieu ung: Diem muon chay hieu ung?
message.animator.running=Hieu ung: Chay hieu ung (click to stop)!
message.animator.segment=Hieu ung: Chon hinh tron hoac doan thang?
message.area=Hinh da giac: Dinh?
message.boundedpoint=Diem thuoc doi tuong: Chon doi tuong ma diem thuoc (hinh tron hoac duong thang) (Shift: Khong co dinh diem khi di chuyen doi tuong)?
message.circle.midpoint=Hinh tron: Tam?
message.circle.radius=Hinh tron: Diem thuoc hinh tron (Shift: Co dinh ban kinh)?
message.circle3.first=Hinh tron: Ban kinh thu nhat?
message.circle3.midpoint=Hinh tron: Tam?
message.circle3.second=Hinh tron: Ban kinh thu hai?
message.delete=Xoa: Chon doi tuong can xoa!
message.draw=Ve bang chuot (Nhan ESC de xoa thao tac ve)
message.edit=Chinh sua doi tuong: Chon doi tuong can chinh sua (shift: Chinh sua nhieu doi tuong, ctrl: Chinh sua co dieu kien)?
message.expression=Arithmetic Expression: Select a place!
message.fixedangle.first=Goc voi do lon co dinh: Diem thu nhat?
message.fixedangle.root=Goc voi do lon co dinh: Dinh?
message.fixedangle.second=Goc voi do lon co dinh: Diem thu hai?
message.fixedcircle.midpoint=Hinh tron voi do lon co dinh: Tam?
message.fixedcircle.radius=Hinh tron voi do lon co dinh: Ban kinh?
message.fixedsegment.first=Doan thang voi do dai co dinh: Diem thu nhat?
message.fixedsegment.second=Doan thang voi do dai co dinh: Diem thu hai?
message.hide=An / Hien: Chon doi tuong can an / hien!
message.image=Image anchor point %
message.image.last=Last image anchor point (or choose selected point)
message.intersection.first=Giao diem: Doi tuong thu nhat?
message.intersection.second=Giao diem: Doi tuong thu hai?
message.label.move=Di chuyen nhan ten: Nhan ten can di chuyen!
message.label.select=Di chuyen nhan ten: Chon nhan ten ma ban muon di chuyen!
message.line.first=Duong thang: Diem thu nhat?
message.line.second=Duong thang: Diem thu hai?
message.midpoint.first=Trung diem: Diem thu nhat?
message.midpoint.second=Trung diem: Diem thu hai?
message.move.move=Di chuyen: Di chuyen diem\
message.move.select=Di chuyen(m)): Chon diem can di chuyen (Shift: Di chuyen nhieu doi tuong. / Ctrl+(Diem): Hien thi vi tri ban dau cua doi tuong / Ctrl: Di chuyen hinh tron co dinh)
message.objecttracker.move=Autotrack: Move the point!
message.objecttracker.object=Autotrack: Line or circle, point on object, slider?
message.objecttracker.select=Autotrack: Point or line to track (shift: more)?
message.objecttracker.selectanypoint=Autotrack: Any other point to move?
message.objecttracker.selectpoint=Autotrack: Point to be moved on line or circle?
message.objecttracker.start=Autotrack: Bat dau chay hieu ung!
message.objecttracker.stop=Autotrack: Click to stop (shift left/right for speed)!
message.parallel.first=Song song: Doi tuong can lay song song?
message.parallel.second=Song song: Diem thuoc duong thang song song voi doi tuong cho truoc?
message.parameters=Thong so Macro: Nhung doi tuong can lay thong so?
message.plumb.first=Vuong goc: Doi tuong can lay vuong goc?
message.plumb.second=Vuong goc: Diem thuoc duong thang vuong goc voi doi tuong cho truoc?
message.point=Diem: Chon 1 diem (Shift: Co dinh diem)!
message.quadric=Duong Conic: Diem thu
message.range.first=Set range: Draw the circle from which point...
message.range.second=Set range: ...to which point?
message.ray.first=Tia: Diem goc?
message.ray.second=Tia: Diem thu hai thuoc tia?
message.rename=Chon doi tuong can thay doi ten !
message.reorder=Sap xep doi tuong: Chon doi tuong sap xep!
message.runmacro=Macro %: %. % - %
message.runmacro.fixes=(Shift: De co dinh)
message.runmacro.return=(Nhan SPACE tuy chon %)
message.savejob.first=Define Assignment: Last displayed object?
message.savejob.second=Define Assignment: Target object (shift: don't check)?
message.savejob.third=Define Assignment: Further objects to be displayed?
message.saving=Vui long cho!
message.segment.first=Doan thang: Diem thu nhat?
message.segment.second=Doan thang: Diem thu hai (Shift: Co dinh chieu dai doan thang)?
message.setaway.away=Keep the intersection away from which point?
message.setaway.close=Keep the intersection close to which point?
message.setcenter=Chon diem nam giua!
message.setfixedangle.first=Thiet lap goc co dinh: Diem thu nhat?
message.setfixedangle.second=Thiet lap goc co dinh: Diem thu hai?
message.setfixedangle.third=Thiet lap goc co dinh: Diem thu ba?
message.setfixedcircle.first=Thiet lap hinh tron co dinh: Diem thu nhat?
message.setfixedcircle.second=Thiet lap hinh tron co dinh: Diem thu hai?
message.targets=Macro Targets: Target objects?
message.text=Ghi chu: Chon vi tri dat ghi chu!
message.tracker.move=Track: Move the point!
message.tracker.select=Track: Point or line to track (shift: more)?
message.tracker.selectpoint=Track: Point to move?
message.zoom=Di chuyen nut cuon tren chuot de phong to / thu nho
minfontsize.prompt=Kich thuoc font nho nhat (Mac dinh: 12)
minlinesize.prompt=Do day nho nhat cua duong thang (Mac dinh: 1)
minpointsize.prompt=Kich thuoc nho nhat cua diem (Mac dinh: 3)
myfiledialog.back=Quay lai
myfiledialog.dir=Muc luc
myfiledialog.file=Tap tin
myfiledialog.homedir=Tap tin CaR
myfiledialog.mkdir=Soan thao muc luc
myfiledialog.oldfiles=Tap tin cu
myfiledialog.pattern=Extensions
myfiledialog.windowshome=My Documents
name.Angle=Goc
name.Circle=Hinh tron
name.Circle3=Hinh tron
name.Expression=Bieu thuc
name.FixedAngle=Goc co dinh
name.Intersection=Giao diem
name.Line=Duong thang
name.Midpoint=Trung diem
name.OtherIntersection=Giao diem
name.Parallel=Duong thang song song
name.Plumb=Duong thang vuong goc
name.Point=Diem
name.PointOn=Doi tuong diem
name.Polygon=Hinh da giac
name.Quadric=Duong Conic
name.Ray=Tia
name.Segment=Doan thang
name.TwoPointLine=Duong thang di qua 2 diem
name.short.Angle=a
name.short.Circle=c
name.short.Circle3=c
name.short.Expression=E
name.short.Function=f
name.short.Intersection=I
name.short.Line=l
name.short.Midpoint=M
name.short.OtherIntersection=I
name.short.Parallel=pl
name.short.Plumb=p
name.short.Point=P
name.short.PointOn=OP
name.short.Polygon=poly
name.short.Quadric=Q
name.short.Ray=r
name.short.Segment=s
name.short.Track=Tr
no=Khong
objects.angle=Goc
objects.animate=Hieu ung
objects.area=Hinh da giac
objects.boundedpoint=Diem thuoc doi tuong
objects.circle=Hinh tron
objects.circle3=Hinh tron qua 3 diem
objects.definejob=Define an Assignment
objects.delete=Xoa doi tuong va doi tuong con cua no
objects.draw=Ve voi chuot
objects.edit=Chinh sua diem
objects.expression=Arithmetic Expression
objects.fixedangle=Goc co dinh
objects.fixedcircle=Hinh tron voi kich thuoc co dinh
objects.fixedsegment=Doan thang voi do dai co dinh
objects.hide=An doi tuong
objects.image=Tai hinh (_)
objects.intersection=Giao diem
objects.line=Duong thang
objects.midpoint=Trung diem
objects.move=Di chuyen diem
objects.objecttracker=Track a Point or a Line on an Object
objects.parallel=Duong thang song song
objects.parameter=Thiet lap thong so Macro
objects.plumb=Duong thang vuong goc
objects.point=Diem
objects.quadric=Duong Conic
objects.ray=Tia
objects.rename=Thay doi ten...
objects.reorder=Sap xep doi tuong
objects.runmacro=Chay Macro
objects.segment=Doan thang
objects.targets=Set Macro Targets
objects.text=Ghi chu
objects.tracker=Track a Point or a Line
objects.zoom=Phong to / Thu nho bang chuot
objectsedit.title=Chinh sua thuoc tinh
ok=Dong y
pattern=*.zir *.job *.xml
pattern.bitmap=*.bmp
pattern.export=*.html *.htm
pattern.job=*.job *.xml
pattern.macro=*.mcr
pattern.run=*.run
point.type.circle=Hinh tron
point.type.cross=Dang dau +
point.type.dcross=Dang dau x
point.type.diamond=Hinh thoi
point.type.dot=Dang dau .
point.type.square=Hinh vuong
popup.empty=--- Macros ---
popup.hidden=Hien thi doi tuong an
popup.replay=Xem lai cach dung hinh
printscaler.aspect=Keep Aspect Ratio
printscaler.dpi=Resolution (in dpi, default 300)
printscaler.h=Chieu cao (theo pixel)
printscaler.height=Chieu cao (theo cm)
printscaler.latex=Luu dang LaTeX
printscaler.linewidth=Do day duong thang (theo cm , mac dinh 0.02)
printscaler.middle=Cut out from screen
printscaler.pointsize=Kich thuoc diem (theo cm, mac dinh 0.07)
printscaler.preset=Make a Choice
printscaler.preset.300dpi=Co gian ra 300DPI
printscaler.preset.300dpi12=12 cm width with 300 DPI
printscaler.preset.300dpi16=16 cm Width with 300 DPI
printscaler.preset.300dpi6=6 cm Width with 300 DPI
printscaler.preset.clip50=Window Size Clipped 50%
printscaler.preset.latex10=LaTeX 10pt
printscaler.preset.window=Kich thuoc cua so
printscaler.presets=Thiet lap so bo
printscaler.scale=Scale (relativ to screen)
printscaler.screen=300 DPI
printscaler.sizes=Nhap gia tri
printscaler.textsize=Kich thuoc (theo cm, mac dinh 0.3)
printscaler.title=Thiet lap kich thuoc
printscaler.w=Chieu rong (theo pixel)
printscaler.width=Chieu rong (theo cm)
program.date=2006-11
program.name=C.a.R
program.version=5.2
prompt.angle==a(,,)
prompt.area=A(,,)
prompt.circle==c(,)
prompt.circle3==c(,,)
prompt.function=function(,,,,,)
prompt.image=image(,,,)
prompt.intersection==I(,)
prompt.line==l(,)
prompt.midpoint==M(,)
prompt.parallel==pl(,)
prompt.plumb==p(,)
prompt.point==P
prompt.pointon==P()
prompt.quadric=quadric(,,,,)
prompt.ray==r(,)
prompt.segment==s(,)
question.again=HOi lai lan sau.
question.intersection=Tao giao diem?
question.pointon=Tao diem thuoc doi tuong do?
question.title=Cau hoi
renamemacro.name=Ten moi cua Macro
renamemacro.title=Doi ten Macro
reorder.message=Chen vao phia sau
reorder.notfound=Doi tuong khong hop le!
reorder.title=Push objects
reorder.warning=Could not do that!
replay.title=Xem lai
save=Luu
savequestion.qsave=Ban co muon luu tap tin?
savequestion.title=Luu
select.all=Tat ca
select.cancel=Huy bo
select.comment=Hien thi ghi chu
select.comment.title=Ghi chu Macro
select.ok=Dong y
select.title=Tuy chon
selectionsize.prompt=Tuy chon kich thuoc (mac dinh: 1.5)
setgrid.prompt=Nhap vao chieu rong cua luoi
setgrid.set=Thiet lap
setgrid.title=Grid Width
shortcuts.angle=a
shortcuts.animate="
shortcuts.area=0
shortcuts.boundedpoint=5
shortcuts.circle=c
shortcuts.circle3=3
shortcuts.color.0=(Ctrl-1)
shortcuts.color.1=(Ctrl-2)
shortcuts.color.2=(Ctrl-3)
shortcuts.color.3=(Ctrl-4)
shortcuts.definejob=6
shortcuts.delete=Del
shortcuts.draw=;
shortcuts.edit=e
shortcuts.expression=x
shortcuts.fixedangle=.
shortcuts.fixedcircle=,
shortcuts.fixedsegment=#
shortcuts.hide=h
shortcuts.image=_
shortcuts.intersection=i
shortcuts.line=g
shortcuts.midpoint=4
shortcuts.move=m
shortcuts.objecttracker=o
shortcuts.parallel=1
shortcuts.parameter=7
shortcuts.plumb=2
shortcuts.point=p
shortcuts.pointtype.0=(Ctrl-5)
shortcuts.pointtype.1=(Ctrl-6)
shortcuts.pointtype.2=(Ctrl-7)
shortcuts.pointtype.3=(Ctrl-8)
shortcuts.pointtype.4=(Ctrl-9)
shortcuts.pointtype.5=(Ctrl-0)
shortcuts.quadric=$
shortcuts.ray=r
shortcuts.rename=:
shortcuts.reorder=!
shortcuts.runmacro=9
shortcuts.segment=s
shortcuts.showcolor.0=(Alt-1)
shortcuts.showcolor.1=(Alt-2)
shortcuts.showcolor.2=(Alt-3)
shortcuts.showcolor.3=(Alt-4)
shortcuts.targets=8
shortcuts.text=b
shortcuts.thickness.0=(Alt-5)
shortcuts.thickness.1=(Alt-6)
shortcuts.thickness.2=(Alt-7)
shortcuts.thickness.3=(Alt-8)
shortcuts.tracker=t
shortcuts.zoom=%
sizesdialog.title=Kich thuoc
sure.delete=Khong luu cac thay doi?
sure.macros=Xoa tat ca cac Macro da dinh nghia?
sure.title=Are you sure?
templateload.open=Load Template
templateload.open.action=Mo
text.angle=Goc % - % - %
text.angle.fixed=Goc % - % - % voi do lon %
text.area=Hinh da giac
text.boundedpoint=Diem %
text.circle=Hinh tron tam % qua %
text.circle.fixed=Hinh tron tam % qua % , co ban kinh %
text.circle3=Hinh tron tam % voi ban kinh tu % den %
text.expression=Bieu thuc "%" tai %, %
text.fixedangle=Goc % - % voi do lon %
text.fixedcircle=Hinh tron tam %, ban kinh %
text.function=Ham so (%,%)
text.intersection=Giao diem cua % va %
text.line=Duong thang qua % va %
text.midpoint=Trung diem cua % va %
text.parallel=Duong thang qua % va song song voi %
text.plumb=Duong thang qua % va vuong goc voi %
text.point= (%,%)
text.quadric=Duong Conic qua %
text.ray=Tia tu % qua %
text.segment=Doan thang tu % den %
text.segment.fixed=Doan thang tu % den % va co do dai %
text.track=Track of % when % moves on %
text.trackof=Track of % when % changes
title=School Geometry
trackquestion.keep=Keep Track in Construction?
trackquestion.title=Keep Track
true=Dung
version=Phien ban
warning.loadbackground=Loi! Khong the tai hinh nen
warning.loadmacros=Loi! Khong the tai 1 Macro rong
warning.macrodefinition=% dang duoc su dung , nhung no khong co trong Macro
warning.nojob=This isn't an Assignment!
warning.preview=Khong chay duoc tren Java 1.1
warning.previewframe=Frame larger than window!
warning.print=In bi loi!
warning.reset=Chuc nang nay se duoc thiet lap sau lan mo chuong trinh ke tiep!
yes=Dong y

View file

@ -0,0 +1,77 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.Evaluator;
public class ConvexMin {
public static double computeMin(final Evaluator F, double a, double b,
final double eps) throws ConstructionException {
final double lambda = (Math.sqrt(5) - 1) / 2;
double x2 = lambda * a + (1 - lambda) * b;
double y2 = F.evaluateF(x2);
double x3 = (1 - lambda) * a + lambda * b;
double y3 = F.evaluateF(x3);
while (b - a > eps) {
if (y2 < y3) {
b = x3;
x3 = x2;
y3 = y2;
x2 = lambda * a + (1 - lambda) * b;
y2 = F.evaluateF(x2);
} else {
a = x2;
x2 = x3;
y2 = y3;
x3 = (1 - lambda) * a + lambda * b;
y3 = F.evaluateF(x3);
}
}
return (a + b) / 2;
}
public static double computeMax(final Evaluator F, double a, double b,
final double eps) throws ConstructionException {
final double lambda = (Math.sqrt(5) - 1) / 2;
double x2 = lambda * a + (1 - lambda) * b;
double y2 = F.evaluateF(x2);
double x3 = (1 - lambda) * a + lambda * b;
double y3 = F.evaluateF(x3);
while (b - a > eps) {
if (y2 > y3) {
b = x3;
x3 = x2;
y3 = y2;
x2 = lambda * a + (1 - lambda) * b;
y2 = F.evaluateF(x2);
} else {
a = x2;
x2 = x3;
y2 = y3;
x3 = (1 - lambda) * a + lambda * b;
y3 = F.evaluateF(x3);
}
}
return (a + b) / 2;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,159 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.expression;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
/**
*
* @author erichake
*/
public class ExpressionColor {
private Construction C;
private ConstructionObject O;
private Expression R_EX=null, G_EX=null, B_EX=null;
public ExpressionColor(Construction c, ConstructionObject o) {
C=c;
O=o;
}
public Color getColor() {
if (R_EX==null) {
return null;
}
try {
int r=(int) R_EX.getValue();
int g=(int) G_EX.getValue();
int b=(int) B_EX.getValue();
return new Color(r, g, b);
} catch (Exception ex) {
return null;
}
}
public void setColor(Color col) {
R_EX=null;
G_EX=null;
B_EX=null;
if (col!=null) {
R_EX=new Expression(""+col.getRed(), C, O);
G_EX=new Expression(""+col.getGreen(), C, O);
B_EX=new Expression(""+col.getBlue(), C, O);
}
}
public void setColor(int red, int green, int blue) {
R_EX=null;
G_EX=null;
B_EX=null;
R_EX=new Expression(""+red, C, O);
G_EX=new Expression(""+green, C, O);
B_EX=new Expression(""+blue, C, O);
}
public void setColor(String red, String green, String blue) {
R_EX=null;
G_EX=null;
B_EX=null;
R_EX=new Expression(red, C, O);
G_EX=new Expression(green, C, O);
B_EX=new Expression(blue, C, O);
}
public String getRedExpression() {
if (R_EX==null) {
return "";
}
return R_EX.toString();
}
public String getGreenExpression() {
if (G_EX==null) {
return "";
}
return G_EX.toString();
}
public String getBlueExpression() {
if (B_EX==null) {
return "";
}
return B_EX.toString();
}
public void setRed(String s) throws ConstructionException {
Expression red=new Expression(s, C, O);
if (red.isValid()) {
R_EX=null;
R_EX=red;
if (G_EX==null) G_EX=new Expression("0", C, O);
if (B_EX==null) B_EX=new Expression("0", C, O);
} else {
throw new ConstructionException(red.getErrorText());
}
}
public void setGreen(String s) throws ConstructionException {
Expression green=new Expression(s, C, O);
if (green.isValid()) {
G_EX=null;
G_EX=green;
if (R_EX==null) R_EX=new Expression("0", C, O);
if (B_EX==null) B_EX=new Expression("0", C, O);
} else {
throw new ConstructionException(green.getErrorText());
}
}
public void setBlue(String s) throws ConstructionException {
Expression blue=new Expression(s, C, O);
if (blue.isValid()) {
B_EX=null;
B_EX=blue;
if (G_EX==null) G_EX=new Expression("0", C, O);
if (R_EX==null) R_EX=new Expression("0", C, O);
} else {
throw new ConstructionException(blue.getErrorText());
}
}
public int getRed() {
if (R_EX==null) {
return 0;
}
try {
return (int) R_EX.getValue();
} catch (Exception ex) {
return 0;
}
}
public int getGreen() {
if (G_EX==null) {
return 0;
}
try {
return (int) G_EX.getValue();
} catch (Exception ex) {
return 0;
}
}
public int getBlue() {
if (B_EX==null) {
return 0;
}
try {
return (int) B_EX.getValue();
} catch (Exception ex) {
return 0;
}
}
}

View file

@ -0,0 +1,245 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import java.util.Enumeration;
import rene.util.MyVector;
import rene.zirkel.objects.ConstructionObject;
class EquationExpressionString {
public Expression E;
public EquationExpressionString(final Expression o) {
E = o;
}
@Override
public String toString() {
return E.toString();
}
public String getEquation() {
final ConstructionObject o = E.getObject();
if (o == null)
return "???";
else
return o.getEquation();
}
public void translate() {
E.translate();
}
public void addDep(final ConstructionObject o) {
E.addDep(o);
}
}
class NameExpressionString {
public Expression E;
public NameExpressionString(final Expression o) {
E = o;
}
@Override
public String toString() {
return E.toString();
}
public String getName() {
final ConstructionObject o = E.getObject();
if (o == null)
return "???";
else
return o.getName();
}
public void translate() {
E.translate();
}
public void addDep(final ConstructionObject o) {
E.addDep(o);
}
}
/**
* Class containing a chain of strings and expressions for alias and text lines.
*/
public class ExpressionString {
MyVector v = new MyVector(3); // Strings or Expressions
ConstructionObject O;
public ExpressionString(final String s, final ConstructionObject o) {
O = o;
v.removeAllElements();
int h1 = 0;
int n;
while ((n = s.indexOf("%", h1)) >= 0) {
final int h2 = s.indexOf("%", n + 1);
if (h2 == n + 1) // found %%
{
v.addElement(s.substring(h1, n));
v.addElement("%");
h1 = n + 2;
} else if (h2 >= 0) // found %...%
{
v.addElement(s.substring(h1, n));
if (s.charAt(n + 1) == '~') // found %~...%
{
s.substring(n + 2, h2);
v.addElement(new EquationExpressionString(new Expression(s
.substring(n + 2, h2), O.getConstruction(), O)));
h1 = h2 + 1;
} else if (s.charAt(n + 1) == '=') // found %=...%
{
s.substring(n + 2, h2);
v.addElement(new NameExpressionString(new Expression(s
.substring(n + 2, h2), O.getConstruction(), O)));
h1 = h2 + 1;
} else {
final Expression ex = new Expression(
s.substring(n + 1, h2), O.getConstruction(), O);
v.addElement(ex);
h1 = h2 + 1;
}
} else // only one %
{
v.addElement(s.substring(h1, n));
v.addElement("%");
h1 = n + 1;
}
}
if (!s.equals(""))
v.addElement(s.substring(h1));
// System.out.println(evaluate());
}
/**
* Get the original string back (but all objects with correct current
* names).
*/
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
final Enumeration e = v.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof String) {
if (((String) o).equals("%"))
sb.append("%%");
else
sb.append((String) o);
} else if (o instanceof Expression) {
sb.append("%");
if (((Expression) o).isForcePlus())
sb.append("+");
sb.append(o.toString());
sb.append("%");
} else if (o instanceof EquationExpressionString) {
sb.append("%~");
sb.append(((EquationExpressionString) o).toString());
sb.append("%");
} else if (o instanceof NameExpressionString) {
sb.append("%=");
sb.append(((NameExpressionString) o).toString());
sb.append("%");
}
}
return sb.toString();
}
/**
* Get the string with all expressions evaluated.
*
* @return
*/
public String evaluate() {
final StringBuffer sb = new StringBuffer();
final Enumeration e = v.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof String) {
if (((String) o).equals("%"))
sb.append("%");
else
sb.append((String) o);
} else if (o instanceof Expression) {
try {
double value = ((Expression) o).getValue();
value = O.round(value);
if (((Expression) o).isForcePlus() && value >= 0)
sb.append("+");
if (value == Math.floor(value + 0.5))
sb.append((int) (value));
else
sb.append(O.round(value));
} catch (final Exception exc) {
sb.append("???");
}
} else if (o instanceof EquationExpressionString) {
sb.append(((EquationExpressionString) o).getEquation());
} else if (o instanceof NameExpressionString) {
sb.append(((NameExpressionString) o).getName());
}
}
return sb.toString();
}
/**
* Translate the string for macros.
*/
public void translate() {
final Enumeration e = v.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof Expression) {
((Expression) o).translate();
} else if (o instanceof EquationExpressionString) {
((EquationExpressionString) o).translate();
} else if (o instanceof NameExpressionString) {
((NameExpressionString) o).translate();
}
}
}
/**
* Add all objcts this string depends on to the DL of O.
*
* @param O
*/
public void addDep(final ConstructionObject oc) {
final Enumeration e = v.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof Expression) {
((Expression) o).addDep(oc);
} else if (o instanceof EquationExpressionString) {
((EquationExpressionString) o).addDep(oc);
} else if (o instanceof NameExpressionString) {
((NameExpressionString) o).addDep(oc);
}
}
}
}

View file

@ -0,0 +1,35 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.ConstructionException;
public class InvalidException extends ConstructionException {
/**
*
*/
private static final long serialVersionUID = 1L;
public InvalidException(final String s) {
super(s);
}
}

View file

@ -0,0 +1,41 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.ConstructionException;
public class NoValueException extends ConstructionException {
/**
*
*/
private static final long serialVersionUID = 1L;
boolean Valid;
public NoValueException(final boolean valid) {
super("NoValueException");
Valid = valid;
}
public boolean isValid() {
return Valid;
}
}

View file

@ -0,0 +1,277 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
public class Quartic {
static public int solve(final double c[], final double sol[]) {
double sum = 0;
for (final double element : c)
sum += Math.abs(element);
if (sum < 1e-15) {
sol[0] = 0;
return 1;
}
for (int k = 0; k < c.length; k++)
c[k] /= sum;
int n = 4;
while (Math.abs(c[n]) < 1e-15)
n--;
if (n == 4) {
final double soli[] = new double[4];
return quartic(c, sol, soli);
} else if (n == 3) {
return cubic(c, sol);
} else if (n == 2) {
final double a = -c[1] / (2 * c[2]);
final double r = a * a - c[0] / c[2];
if (r < -1e-10)
return 0;
else if (Math.abs(r) < 1e-10) {
sol[0] = a;
return 1;
} else {
sol[0] = a + Math.sqrt(r);
sol[1] = a - Math.sqrt(r);
return 2;
}
} else if (n == 1) {
sol[0] = -c[0] / c[1];
return 1;
} else {
if (Math.abs(c[0]) < 1e-10) {
sol[0] = 0;
return 1;
}
}
return 0;
}
/*-------------------- Global Function Description Block ----------------------
*
* ***QUARTIC************************************************25.03.98
* Solution of a quartic equation
* ref.: J. E. Hacke, Amer. Math. Monthly, Vol. 48, 327-328, (1941)
* NO WARRANTY, ALWAYS TEST THIS SUBROUTINE AFTER DOWNLOADING
* ******************************************************************
* dd(0:4) (i) vector containing the polynomial coefficients
* sol(1:4) (o) results, real part
* soli(1:4) (o) results, imaginary part
* Nsol (o) number of real solutions
* ==================================================================
* 17-Oct-2004 / Raoul Rausch
* Conversion from Fortran to C
*
*
*-----------------------------------------------------------------------------
*/
static int quartic(final double dd[], final double sol[],
final double soli[]) {
final double AA[] = new double[4], z[] = new double[3];
double a, b, c, d, f, p, q, r, zsol, xK2, xL, xK, sqp, sqm;
int ncube, i;
int Nsol = 0;
if (dd[4] == 0.0) {
return 0;
}
a = dd[4];
b = dd[3];
c = dd[2];
d = dd[1];
f = dd[0];
p = (-3.0 * Math.pow(b, 2) + 8.0 * a * c) / (8.0 * Math.pow(a, 2));
q = (Math.pow(b, 3) - 4.0 * a * b * c + 8.0 * d * Math.pow(a, 2))
/ (8.0 * Math.pow(a, 3));
r = (-3.0 * Math.pow(b, 4) + 16.0 * a * Math.pow(b, 2) * c - 64.0
* Math.pow(a, 2) * b * d + 256.0 * Math.pow(a, 3) * f)
/ (256.0 * Math.pow(a, 4));
// Solve cubic resolvent
AA[3] = 8.0;
AA[2] = -4.0 * p;
AA[1] = -8.0 * r;
AA[0] = 4.0 * p * r - Math.pow(q, 2);
ncube = cubic(AA, z);
zsol = -1.e99;
for (i = 0; i < ncube; i++)
zsol = Math.max(zsol, z[i]); // Not sure C has max fct
z[0] = zsol;
xK2 = 2.0 * z[0] - p;
xK = Math.sqrt(xK2);
xL = q / (2.0 * xK);
sqp = xK2 - 4.0 * (z[0] + xL);
sqm = xK2 - 4.0 * (z[0] - xL);
for (i = 0; i < 4; i++)
soli[i] = 0.0;
if ((sqp >= 0.0) && (sqm >= 0.0)) {
sol[0] = 0.5 * (xK + Math.sqrt(sqp));
sol[1] = 0.5 * (xK - Math.sqrt(sqp));
sol[2] = 0.5 * (-xK + Math.sqrt(sqm));
sol[3] = 0.5 * (-xK - Math.sqrt(sqm));
Nsol = 4;
} else if ((sqp >= 0.0) && (sqm < 0.0)) {
sol[0] = 0.5 * (xK + Math.sqrt(sqp));
sol[1] = 0.5 * (xK - Math.sqrt(sqp));
sol[2] = -0.5 * xK;
sol[3] = -0.5 * xK;
soli[2] = Math.sqrt(-.25 * sqm);
soli[3] = -Math.sqrt(-.25 * sqm);
Nsol = 2;
} else if ((sqp < 0.0) && (sqm >= 0.0)) {
sol[0] = 0.5 * (-xK + Math.sqrt(sqm));
sol[1] = 0.5 * (-xK - Math.sqrt(sqm));
sol[2] = 0.5 * xK;
sol[3] = 0.5 * xK;
soli[2] = Math.sqrt(-0.25 * sqp);
soli[3] = -Math.sqrt(-0.25 * sqp);
Nsol = 2;
} else if ((sqp < 0.0) && (sqm < 0.0)) {
sol[0] = -0.5 * xK;
sol[1] = -0.5 * xK;
soli[0] = Math.sqrt(-0.25 * sqm);
soli[1] = -Math.sqrt(-0.25 * sqm);
sol[2] = 0.5 * xK;
sol[3] = 0.5 * xK;
soli[2] = Math.sqrt(-0.25 * sqp);
soli[3] = -Math.sqrt(-0.25 * sqp);
Nsol = 0;
}
for (i = 0; i < 4; i++)
sol[i] -= b / (4.0 * a);
return Nsol;
}
/*-------------------- Global Function Description Block ----------------------
*
* ***CUBIC************************************************08.11.1986
* Solution of a cubic equation
* Equations of lesser degree are solved by the appropriate formulas.
* The solutions are arranged in ascending order.
* NO WARRANTY, ALWAYS TEST THIS SUBROUTINE AFTER DOWNLOADING
* ******************************************************************
* A(0:3) (i) vector containing the polynomial coefficients
* X(1:L) (o) results
* L (o) number of valid solutions (beginning with X(1))
* ==================================================================
* 17-Oct-2004 / Raoul Rausch
* Conversion from Fortran to C
*
*
*-----------------------------------------------------------------------------
*/
static public int cubic(final double A[], final double X[]) {
final double PI = 3.1415926535897932;
final double THIRD = 1. / 3.;
final double U[] = new double[3];
double W, P, Q, DIS, PHI;
int i;
int L;
if (A[3] != 0.0) {
// cubic problem
W = A[2] / A[3] * THIRD;
P = Math.pow((A[1] / A[3] * THIRD - Math.pow(W, 2)), 3);
Q = -.5 * (2.0 * Math.pow(W, 3) - (A[1] * W - A[0]) / A[3]);
DIS = Math.pow(Q, 2) + P;
if (DIS < 0.0) {
// three real solutions!
// Confine the argument of ACOS to the interval [-1;1]!
PHI = Math.acos(Math
.min(1.0, Math.max(-1.0, Q / Math.sqrt(-P))));
P = 2.0 * Math.pow((-P), (5.e-1 * THIRD));
for (i = 0; i < 3; i++)
U[i] = P * Math.cos((PHI + 2 * ((double) i) * PI) * THIRD)
- W;
X[0] = Math.min(U[0], Math.min(U[1], U[2]));
X[1] = Math.max(Math.min(U[0], U[1]), Math.max(Math.min(U[0],
U[2]), Math.min(U[1], U[2])));
X[2] = Math.max(U[0], Math.max(U[1], U[2]));
L = 3;
} else {
// only one real solution!
DIS = Math.sqrt(DIS);
X[0] = CBRT(Q + DIS) + CBRT(Q - DIS) - W;
L = 1;
}
} else if (A[2] != 0.0) {
// quadratic problem
P = 0.5 * A[1] / A[2];
DIS = Math.pow(P, 2) - A[0] / A[2];
if (DIS > 0.0) {
// 2 real solutions
X[0] = -P - Math.sqrt(DIS);
X[1] = -P + Math.sqrt(DIS);
L = 2;
} else {
// no real solution
L = 0;
}
} else if (A[1] != 0.0) {
// linear equation
X[0] = A[0] / A[1];
L = 1;
} else {
// no equation
L = 0;
}
/*
* ==== perform one step of a newton iteration in order to minimize
* round-off errors ====
*/
for (i = 0; i < L; i++) {
X[i] = X[i] - (A[0] + X[i] * (A[1] + X[i] * (A[2] + X[i] * A[3])))
/ (A[1] + X[i] * (2.0 * A[2] + X[i] * 3.0 * A[3]));
}
return L;
}
static double CBRT(final double Z) {
final double THIRD = 1. / 3.;
if (Z > 0)
return Math.pow(Z, THIRD);
else if (Z < 0)
return -Math.pow(Math.abs(Z), THIRD);
else
return 0;
}
/**
* @param args
*/
public static void main(final String[] args) {
final double a[] = { 0, 3, -3, -6, 5 }, x[] = new double[5], y[] = new double[5];
final int n = quartic(a, x, y);
System.out.println(n + " solutions!");
for (int i = 0; i < n; i++)
System.out.println(x[i]);
}
}

View file

@ -0,0 +1,100 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.Evaluator;
public class Romberg {
/**
* Summiere f(x),f(x+h),...,f(x+n*h)
*/
private static double sumUp(final Evaluator F, final double x,
final double h, final int n) throws ConstructionException {
double sum = F.evaluateF(x);
for (int i = 1; i <= n; i++) {
sum = sum + F.evaluateF(x + i * h);
}
return sum;
}
/**
* Romberg-Verfahren.
*
* @param a
* ,b = Intervall-Grenzen
* @param F
* = Funktion, die integriert wird
* @param nstart
* = Anzahl der ersten Unterteilungen
* @param eps
* = Relative Genauigkeit zum Abbruch
* @param maxiter
* = Maximale Iterationen
* @return Integral oder RuntimeException
*/
static public double compute(final Evaluator F, final double a,
final double b, final int nstart, final double eps,
final int maxiter) throws ConstructionException {
// Ergebnisse der Trapezregel mit Schrittweite h/2^i
final double t[] = new double[maxiter];
int n = nstart;
// Anfangsschrittweite
double h = (b - a) / n;
// Berechne Trapezregel dazu und d[0]
double tlast = t[0] = (F.evaluateF(a) + F.evaluateF(b) + 2 * sumUp(F, a
+ h, h, n - 2))
* h / 2;
// Bisheriges Ergebnis festhalten
double old = t[0];
// Halbiere Schrittweite bis Genauigkeit erreicht
for (int i = 1; i < maxiter; i++) { // Halbiere Schrittweite:
h = h / 2;
n = n * 2;
// Berechne Trapezregel (unter Verwendung des
// letzten Ergebnisses:
t[i] = tlast / 2 + sumUp(F, a + h, 2 * h, n / 2 - 1) * h;
tlast = t[i];
// Update der t[i]:
double q = 4;
for (int j = i - 1; j >= 0; j--) {
t[j] = t[j + 1] + (t[j + 1] - t[j]) / (q - 1);
q = q * 4;
}
// Abbruch-Kriterium
final double res = t[0];
if (Math.abs((res - old) / res) < eps)
return res;
old = res;
}
// Bei ?berschreiten der Interationsgrenze:
return tlast;
}
}

View file

@ -0,0 +1,64 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.Evaluator;
public class Secant {
public static double compute(final Evaluator F, double a, double b,
final double eps) throws ConstructionException {
double ay = F.evaluateF(a), by = F.evaluateF(b);
double c = (a + b) / 2;
if (ay * by > eps)
throw new ConstructionException("");
while (Math.abs(b - a) > eps) {
final double cy = F.evaluateF(c);
if (Math.abs(cy) < eps)
return c;
if (cy * ay > 0) {
if (Math.abs(ay - cy) < eps) {
a = c;
ay = cy;
c = (a + b) / 2;
} else {
final double d = a - ay * (a - c) / (ay - cy);
if (d > b || d < a) {
a = c;
ay = cy;
c = (a + b) / 2;
} else {
a = c;
ay = cy;
c = d;
}
}
} else {
final double d = a - ay * (a - c) / (ay - cy);
b = c;
by = cy;
c = d;
}
}
return c;
}
}

View file

@ -0,0 +1,32 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.expression;
import rene.zirkel.construction.Construction;
/**
* @author Rene
*
*/
public interface Translator {
public void laterTranslate(Construction from);
}

View file

@ -0,0 +1,55 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.util.Enumeration;
import rene.util.MyVector;
import rene.zirkel.structures.CoordinatesXY;
// file: Drawing.java
public class Drawing {
MyVector P;
int Col;
public Drawing() {
P = new MyVector();
}
public void addXY(final double x, final double y) {
P.addElement(new CoordinatesXY(x, y));
}
public Enumeration elements() {
return P.elements();
}
public void setColor(final int col) {
Col = col;
}
public int getColor() {
return Col;
}
}

View file

@ -0,0 +1,489 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
/* Graphics class supporting EPS export from plots.
Copyright (c) 1998-2000 The Regents of the University of
California.
Modified, completed and extended by R. Grothmann
*/
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.Shape;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
class EpsFontMetrics extends FontMetrics {
/**
*
*/
private static final long serialVersionUID = 1L;
Font F;
public EpsFontMetrics(final Font f) {
super(f); // a dummy font.
F = f;
}
@Override
public int stringWidth(final String s) {
return s.length() * F.getSize() / 2;
}
@Override
public int getHeight() {
return F.getSize();
}
@Override
public int getAscent() {
return F.getSize() * 4 / 5;
}
}
class EpsPoint {
double x, y;
public EpsPoint(final double xx, final double yy) {
x = xx;
y = yy;
}
}
public class EPSGraphics {
// ///////////////////////////////////////////////////////////////
//
// // private variables
// //
private Color _currentColor = Color.black;
private Font _currentFont;
private final double _height;
int _orientation;
private final OutputStream _out;
private final StringBuffer _buffer = new StringBuffer();
private double LineWidth = 1;
public static final int PORTRAIT = 0;
public static final int LANDSCAPE = 1;
private FontMetrics FM;
public EPSGraphics(final OutputStream out, final double width,
final double height, final int orientation, final boolean clip) {
_height = height;
_orientation = orientation;
_out = out;
_buffer.append("%!PS-Adobe-3.0 EPSF-3.0\n");
_buffer.append("%%Creator: QCircuitBuilder\n");
_buffer.append("%%BoundingBox: 50 50 " + (int) (50 + width) + " "
+ (int) (50 + height) + "\n");
// _buffer.append("%%Orientation: " + (_orientation == PORTRAIT ?
// "Portrait" : "Landscape"));
// _buffer.append("%%PageOrientation: " + (_orientation == PORTRAIT ?
// "Portrait" : "Landscape"));
_buffer.append("%%Pages: 1\n");
_buffer.append("%%Page: 1 1\n");
_buffer.append("%%LanguageLevel: 2\n");
if (clip)
clipRect(0, 0, width, height);
_buffer.append("/Helvetica findfont 10 scalefont setfont\n");
}
public void clearRect(final int x, final int y, final int width,
final int height) {
}
// Clip
public void clipRect(final double x, final double y, final double width,
final double height) {
final EpsPoint start = _convert(x, y);
// _fillPattern();
_buffer.append("newpath " + round(start.x) + " " + round(start.y)
+ " moveto\n");
_buffer.append("0 " + round(-height) + " rlineto\n");
_buffer.append("" + round(width) + " 0 rlineto\n");
_buffer.append("0 " + round(height) + " rlineto\n");
_buffer.append("" + round(-width) + " 0 rlineto\n");
_buffer.append("closepath clip\n");
}
private double round(final double x) {
return Math.round(x * 1000.0) / 1000.0;
}
/**
* Draw a line, using the current color, between the points (x1, y1) and
* (x2, y2) in this graphics context's coordinate system.
*
* @param x1
* the x coordinate of the first point.
* @param y1
* the y coordinate of the first point.
* @param x2
* the x coordinate of the second point.
* @param y2
* the y coordinate of the second point.
*/
public void drawLine(final double x1, final double y1, final double x2,
final double y2) {
final EpsPoint start = _convert(x1, y1);
final EpsPoint end = _convert(x2, y2);
_buffer.append("newpath " + round(start.x) + " " + round(start.y)
+ " moveto\n");
_buffer.append("" + round(end.x) + " " + round(end.y) + " lineto\n");
_buffer.append("stroke\n");
}
/**
* Draw a closed polygon defined by arrays of x and y coordinates. Each pair
* of (x, y) coordinates defines a vertex. The third argument gives the
* number of vertices. If the arrays are not long enough to define this many
* vertices, or if the third argument is less than three, then nothing is
* drawn.
*
* @param xPoints
* An array of x coordinates.
* @param yPoints
* An array of y coordinates.
* @param nPoints
* The total number of vertices.
*/
public void drawPolygon(final double xPoints[], final double yPoints[],
final int nPoints) {
if (!_polygon(xPoints, yPoints, nPoints)) {
return;
} else {
_buffer.append("closepath stroke\n");
}
}
/**
* Draw an oval bounded by the specified rectangle with the current color.
*
* @param x
* The x coordinate of the upper left corner
* @param y
* The y coordinate of the upper left corner
* @param width
* The width of the oval to be filled.
* @param height
* The height of the oval to be filled.
*/
// FIXME: Currently, this ignores the fourth argument and
// draws a circle with diameter given by the third argument.
public void drawOval(final double x, final double y, final double width,
final double height) {
final double radius = width / 2.0;
_buffer.append("newpath " + _convertX(x + radius) + " "
+ _convertY(y + radius) + " " + round(radius)
+ " 0 360 arc closepath stroke\n");
}
public void drawRect(final double x, final double y, final double width,
final double height) {
final EpsPoint start = _convert(x, y);
_buffer.append("newpath " + round(start.x) + " " + round(start.y)
+ " moveto\n");
_buffer.append("0 " + round(-height) + " rlineto\n");
_buffer.append("" + round(width) + " 0 rlineto\n");
_buffer.append("0 " + round(height) + " rlineto\n");
_buffer.append("" + round(-width) + " 0 rlineto\n");
_buffer.append("closepath stroke\n");
}
public void drawRoundRect(final double x, final double y,
final double width, final double height, final int arcWidth,
final int arcHeight) {
}
public void drawString(
final java.text.AttributedCharacterIterator iterator, final int x,
final int y) {
}
public void drawString(final String str, final double x, final double y) {
getFontMetrics();
final EpsPoint start = _convert(x, y);
_buffer.append("" + start.x + " " + start.y + " moveto\n");
_buffer.append("(" + str + ") show\n");
}
public void drawArc(final double x, final double y, final double width,
final double height, final double startAngle, final double arcAngle) {
final double radius = width / 2.0;
_buffer.append("newpath " + _convertX(x + radius) + " "
+ _convertY(y + radius) + " " + round(radius) + " "
+ round(startAngle) + " " + " " + round(startAngle + arcAngle)
+ " arc stroke\n");
}
public void fillArc(final double x, final double y, final double width,
final double height, final double startAngle, final double arcAngle) {
final double radius = width / 2.0;
_buffer.append("newpath " + _convertX(x + radius) + " "
+ _convertY(y + radius) + " " + " moveto "
+ _convertX(x + radius) + " " + _convertY(y + radius) + " "
+ radius + " " + round(startAngle) + " "
+ round(startAngle + arcAngle) + " arc closepath fill\n");
}
public void fillChord(final double x, final double y, final double width,
final double height, final double startAngle, final double arcAngle) {
final double radius = width / 2.0;
_buffer.append("newpath " + _convertX(x + radius) + " "
+ _convertY(y + radius) + " " + round(radius) + " "
+ round(startAngle) + " " + round(startAngle + arcAngle)
+ " arc fill\n");
}
public void fillPolygon(final double xPoints[], final double yPoints[],
final int nPoints) {
if (!_polygon(xPoints, yPoints, nPoints)) {
return;
} else {
_buffer.append("closepath fill\n");
}
}
/**
* Fill an oval bounded by the specified rectangle with the current color.
*
* @param x
* The x coordinate of the upper left corner
* @param y
* The y coordinate of the upper left corner
* @param width
* The width of the oval to be filled.
* @param height
* The height of the oval to be filled.
*/
// FIXME: Currently, this ignores the fourth argument and draws a circle
// with diameter given by the third argument.
public void fillOval(final double x, final double y, final double width,
final double height) {
final double radius = width / 2.0;
_buffer.append("newpath " + _convertX(x + radius) + " "
+ _convertY(y + radius) + " " + radius
+ " 0 360 arc closepath fill\n");
}
/**
* Fill the specified rectangle and draw a thin outline around it. The left
* and right edges of the rectangle are at x and x + width - 1. The top and
* bottom edges are at y and y + height - 1. The resulting rectangle covers
* an area width pixels wide by height pixels tall. The rectangle is filled
* using the brightness of the current color to set the level of gray.
*
* @param x
* The x coordinate of the top left corner.
* @param y
* The y coordinate of the top left corner.
* @param width
* The width of the rectangle.
* @param height
* The height of the rectangle.
*/
public void fillRect(final double x, final double y, final double width,
final double height) {
final EpsPoint start = _convert(x, y);
// _fillPattern();
_buffer.append("newpath " + start.x + " " + start.y + " moveto\n");
_buffer.append("0 " + round(-height) + " rlineto\n");
_buffer.append("" + round(width) + " 0 rlineto\n");
_buffer.append("0 " + round(height) + " rlineto\n");
_buffer.append("" + round(-width) + " 0 rlineto\n");
_buffer.append("closepath gsave fill grestore\n");
_buffer.append("0.5 setlinewidth 0 setgray [] 0 setdash stroke\n");
// reset the gray scale to black
_buffer.append(round(LineWidth) + " setlinewidth\n");
}
public void fillRoundRect(final double x, final double y,
final double width, final double height, final int arcWidth,
final int arcHeight) {
}
public Shape getClip() {
return null;
}
public Rectangle getClipBounds() {
return null;
}
public Color getColor() {
return _currentColor;
}
public Font getFont() {
return _currentFont;
}
public FontMetrics getFontMetrics(final Font f) {
if (FM == null)
FM = new EpsFontMetrics(new Font("dialog", Font.PLAIN, 20));
return FM;
}
public FontMetrics getFontMetrics() {
return getFontMetrics(_currentFont);
}
public void setFont(final Font font) {
final int size = font.getSize();
final boolean bold = font.isBold();
if (bold) {
_buffer.append("/Helvetica-Bold findfont\n");
} else {
_buffer.append("/Helvetica findfont\n");
}
_buffer.append("" + size + " scalefont setfont\n");
_currentFont = font;
FM = new EpsFontMetrics(font);
}
public void setClip(final Shape clip) {
}
public void setClip(final int x, final int y, final int width,
final int height) {
}
/**
* Set the current color.
*
* @param c
* The desired current color.
*/
public void setColor(final Color c) {
_buffer.append(c.getRed() / 255.0);
_buffer.append(" ");
_buffer.append(c.getGreen() / 255.0);
_buffer.append(" ");
_buffer.append(c.getBlue() / 255.0);
_buffer.append(" setrgbcolor\n");
// _buffer.append("[] 0 setdash\n");
// _buffer.append("1 setlinewidth\n");
_currentColor = c;
}
public void setLineWidth(final double w) {
_buffer.append(round(w) + " setlinewidth\n");
LineWidth = w;
}
public void setDash(final double a, final double b) {
_buffer.append("[" + round(a) + " " + round(b) + " ] 0 setdash\n");
}
public void clearDash() {
_buffer.append("[ ] 0 setdash\n");
}
public void setPaintMode() {
}
public void setXORMode(final Color c1) {
}
/**
* Issue the PostScript showpage command, then write and flush the output.
*/
public void showpage(final String name) {
try {
// _buffer.append("showpage\n");
_buffer.append("%%EOF");
final PrintWriter output = new PrintWriter(new java.io.FileWriter(
name));
output.println(_buffer.toString());
output.flush();
} catch (final Exception e) {
e.printStackTrace();
}
}
/**
* Issue the PostScript showpage command, then write and flush the output.
*/
public void close() throws IOException {
_buffer.append("showpage\n");
_buffer.append("%%EOF");
final PrintWriter output = new PrintWriter(_out);
output.println(_buffer.toString());
output.flush();
}
// ///////////////////////////////////////////////////////////////
//
// // private methods
// //
// Convert the screen coordinate system to that of postscript.
private EpsPoint _convert(final double x, final double y) {
return new EpsPoint(round(x + 50), round(_height + 50 - y));
}
private double _convertX(final double x) {
return round(x + 50);
}
private double _convertY(final double y) {
return round(_height + 50 - y);
}
// Draw a closed polygon defined by arrays of x and y coordinates.
// Return false if arguments are misformed.
private boolean _polygon(final double xPoints[], final double yPoints[],
final int nPoints) {
if (nPoints < 3 || xPoints.length < nPoints || yPoints.length < nPoints)
return false;
final EpsPoint start = _convert(xPoints[0], yPoints[0]);
_buffer.append("newpath " + round(start.x) + " " + round(start.y)
+ " moveto\n");
for (int i = 1; i < nPoints; i++) {
final EpsPoint vertex = _convert(xPoints[i], yPoints[i]);
_buffer.append("" + round(vertex.x) + " " + round(vertex.y)
+ " lineto\n");
}
return true;
}
}

View file

@ -0,0 +1,58 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.awt.Font;
/**
* @author Rene An internal class to hold a font sructure (size, face and font
* object)
*/
public class FontStruct {
final int max = 4;
double Size[] = new double[max];
boolean Bold[] = new boolean[max];
Font F[] = new Font[4];
int Next = 0;
public void storeFont(double size, final boolean bold, final Font f) {
if (Next >= max)
Next = 0;
Size[Next] = size;
Bold[Next] = bold;
F[Next] = f;
Next++;
}
public Font getFont(double size, final boolean bold) {
for (int i = 0; i < max; i++) {
if (F[i] == null)
break;
if (Size[i] == size && Bold[i] == bold)
return F[i];
}
return null;
}
public static void main(final String[] args) {
}
}

View file

@ -0,0 +1,96 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.util.Enumeration;
import java.util.Vector;
import rene.zirkel.objects.FunctionObject;
import rene.zirkel.structures.Coordinates;
/**
* @author Rene
*
*/
public class FunctionPolygonFiller {
MyGraphics G;
FunctionObject O;
Vector V;
double Ymin, Ymax;
boolean cartesian = true;
public FunctionPolygonFiller(final MyGraphics g, final FunctionObject o,
final double ymin, final double ymax) {
G = g;
O = o;
Ymin = ymin - 100;
Ymax = ymax + 100;
cartesian = O.isCartesian();
V = new Vector();
}
public void add(final double c, final double r) {
double r0 = r;
if (r > Ymax) {
r0 = Ymax;
} else if (r < Ymin) {
r0 = Ymin;
}
V.add(new Coordinates(c, r0));
}
public void fillPolygon(final double origin) {
final int bord = cartesian ? 2 : 0;
final int nx = V.size() + bord;
if (nx > bord) {
final double x[] = new double[nx];
final double y[] = new double[nx];
final Enumeration e = V.elements();
int i = 0;
if (e.hasMoreElements()) {
final Coordinates c = (Coordinates) e.nextElement();
if (cartesian) {
x[i] = c.X;
y[i++] = origin;
x[i] = c.X;
y[i++] = c.Y;
} else {
x[i] = c.X;
y[i++] = c.Y;
}
}
while (e.hasMoreElements()) {
final Coordinates c = (Coordinates) e.nextElement();
x[i] = c.X;
y[i++] = c.Y;
}
if (cartesian) {
x[i] = x[i - 1];
y[i] = origin;
}
G.fillPolygon(x, y, nx, false, true, O);
V.removeAllElements();
}
}
}

View file

@ -0,0 +1,94 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.io.PrintWriter;
import rene.gui.Global;
public class LatexOutput {
PrintWriter Out;
double W, H;
boolean DoubleDollar, Dollar, NoDollar;
public LatexOutput(final PrintWriter out) {
Out = out;
DoubleDollar = Global.getParameter("options.doubledollar", true);
Dollar = Global.getParameter("options.dollar", true);
NoDollar = Global.getParameter("options.nodollar", false);
}
public void open(final double w, final double h, final double dpi,
final String picfilename) {
W = w;
H = h;
Out.println("\\setlength{\\unitlength}{" + (2.54 / dpi) + "cm}");
Out.println("\\begin{picture}(" + round(w) + "," + round(h) + ")");
final String s = picfilename.replace('\\', '/');
Out.println("\\put(0,0){\\includegraphics[width="
+ round(w / dpi * 2.54) + "cm]{" + s + "}}");
Out.println("%\\put(0,0){\\includegraphics[width="
+ round(w / dpi * 2.54) + "cm,bb=0 0 " + ((int) w) + " "
+ ((int) h) + "]{" + s + "}}");
}
public void close() {
Out.println("\\end{picture}");
Out.close();
}
public boolean println(String s, final double x, final double y,
final boolean force) {
if (s.startsWith("$$")) {
if (!DoubleDollar)
return false;
s = s.substring(1);
if (s.endsWith("$$"))
s = s.substring(0, s.length() - 1);
if (!s.endsWith("$"))
s = s + "$";
} else if (!force && s.startsWith("$")) {
if (!Dollar)
return false;
if (!s.endsWith("$"))
s = s + "$";
} else if (!force) {
if (!NoDollar)
return false;
}
// Out.println("\\put("+round(x)+","+round(H-y)+"){\\makebox(0,0)[lt]{"+s+"}}");
Out.println("\\put(" + round(x) + "," + round(H - y) + "){" + s + "}");
return true;
}
public boolean println(final String s, final double x, final double y) {
return println(s, x, y, false);
}
public double round(final double x) {
return Math.floor(x * 1000 + 0.5) / 1000;
}
public boolean printDollar() {
return Dollar;
}
}

View file

@ -0,0 +1,867 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.ImageObserver;
import rene.gui.Global;
import rene.zirkel.ZirkelFrame;
import rene.zirkel.objects.ConstructionObject;
import rene.zirkel.objects.PointObject;
import de.erichseifert.vectorgraphics2d.EPSGraphics2D;
import de.erichseifert.vectorgraphics2d.SVGGraphics2D;
import de.erichseifert.vectorgraphics2d.VectorGraphics2D;
import java.awt.geom.Path2D;
import rene.zirkel.ZirkelCanvas;
public class MainGraphics extends MyGraphics {
Graphics2D G=null;
BasicStroke Thin, Normal, Thick, SuperThick, DCross, DCrossNormal;
// AlphaComposite C, CO;
ZirkelCanvas ZC=null;
// Constructeur appelé par le paint de ZirkelCanvas ainsi que pour les exports :
public MainGraphics(final Graphics2D g, ZirkelCanvas zc) {
G=g;
ZC=zc;
G.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
G.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
G.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
G.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
G.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
if ((G instanceof EPSGraphics2D)||(G instanceof SVGGraphics2D)) {
VectorGraphics2D vg2D=(VectorGraphics2D) G;
vg2D.setFontRendering(VectorGraphics2D.FontRendering.VECTORS);
}
setDefaultLineSize(ZC.lineSize());
setDefaultFont(ZC.fontSize(), Global.getParameter("font.large", false), Global.getParameter("font.bold", false));
}
@Override
public void setColor(final Color c) {
G.setColor(c);
}
@Override
public void setColor(final ConstructionObject o) {
G.setStroke(Normal);
Color Col, LightCol, BrighterCol, BrighterLightCol;
// it's a personnal color :
if (o.getSpecialColor()!=null) {
final int i=o.getConditionalColor();
if (i!=-1) {
Col=ZirkelFrame.Colors[i];
LightCol=ZirkelFrame.LightColors[i];
BrighterCol=ZirkelFrame.BrighterColors[i];
BrighterLightCol=ZirkelFrame.BrighterLightColors[i];
} else {
final double lambda=0.4;
Col=o.getSpecialColor();
// System.out.println(o.getName()+" : "+Col);
final int r=(int) (255*(1-lambda)+Col.getRed()*lambda);
final int g=(int) (255*(1-lambda)+Col.getGreen()
*lambda);
final int b=(int) (255*(1-lambda)+Col.getBlue()
*lambda);
LightCol=new Color(r, g, b);
BrighterCol=Col.brighter();
BrighterLightCol=LightCol.brighter();
}
} else {
final int i=o.getColorIndex();
Col=ZirkelFrame.Colors[i];
LightCol=ZirkelFrame.LightColors[i];
BrighterCol=ZirkelFrame.BrighterColors[i];
BrighterLightCol=ZirkelFrame.BrighterLightColors[i];
}
if (o.isJobTarget()) {
setColor(ZirkelFrame.TargetColor);
} else if (o.indicated()) {
setColor(ZirkelFrame.IndicateColor);
} else if (o.selected()) {
setColor(ZirkelFrame.SelectColor);
} else {
if (o.getColorType()==ConstructionObject.THIN) {
if (o.isHidden()) {
setColor(BrighterLightCol);
} else {
setColor(LightCol);
}
} else {
if (o.isHidden()) {
setColor(BrighterCol);
} else {
setColor(Col);
}
}
}
if (o.getColorType()==ConstructionObject.THIN) {
G.setStroke(Thin);
} else if (o.getColorType()==ConstructionObject.THICK) {
G.setStroke(Thick);
} else {
G.setStroke(Normal);
}
}
@Override
public void clearRect(final int x, final int y, final int w, final int h,
final Color c) {
G.setColor(c);
G.fillRect(x, y, w, h);
}
@Override
public void setFillColor(final ConstructionObject o) {
G.setStroke(Normal);
if (o.isJobTarget()) {
setColor(ZirkelFrame.TargetColor);
} else if ((o instanceof PointObject)&&o.indicated()) {
setColor(ZirkelFrame.IndicateColor);
} else {
Color Col, LightCol, BrighterCol, BrighterLightCol;
// it's a personnal color :
if (o.getSpecialColor()!=null) {
final int i=o.getConditionalColor();
if (i!=-1) {
Col=ZirkelFrame.Colors[i];
LightCol=ZirkelFrame.LightColors[i];
BrighterCol=ZirkelFrame.BrighterColors[i];
BrighterLightCol=ZirkelFrame.BrighterLightColors[i];
} else {
final double lambda=0.4;
Col=o.getSpecialColor();
final int r=(int) (255*(1-lambda)+Col.getRed()
*lambda);
final int g=(int) (255*(1-lambda)+Col.getGreen()
*lambda);
final int b=(int) (255*(1-lambda)+Col.getBlue()
*lambda);
LightCol=new Color(r, g, b);
BrighterCol=Col.brighter();
BrighterLightCol=LightCol.brighter();
}
} else {
final int i=o.getColorIndex();
Col=ZirkelFrame.Colors[i];
LightCol=ZirkelFrame.LightColors[i];
BrighterCol=ZirkelFrame.BrighterColors[i];
BrighterLightCol=ZirkelFrame.BrighterLightColors[i];
}
if (o.getColorType()!=ConstructionObject.THICK) {
if (o.isHidden()) {
setColor(BrighterLightCol);
} else {
setColor(LightCol);
}
} else {
if (o.isHidden()) {
setColor(BrighterCol);
} else {
setColor(Col);
}
}
if (o.getColorType()==ConstructionObject.THIN) {
G.setStroke(Thin);
} else if (o.getColorType()==ConstructionObject.THICK) {
G.setStroke(Thick);
} else {
G.setStroke(Normal);
}
}
}
@Override
public void setLabelColor(final ConstructionObject o) {
if (o.labelSelected()) {
setColor(ZirkelFrame.SelectColor);
} else if (o.isFilled()) {
final int type=o.getColorType();
o.setColorType(ConstructionObject.NORMAL);
setColor(o);
o.setColorType(type);
} else {
setColor(o);
}
}
@Override
public void drawRect(final double x, final double y, final double w,
final double h) {
if (test(x)||test(y)||test(x+w)||test(y+h)) {
return;
}
G.setStroke(Normal);
G.draw(new Rectangle2D.Double(x, y, w, h));
}
public void drawMarkerRect(final double x, final double y, final double w,
final double h) {
if (test(x)||test(y)||test(x+w)||test(y+h)) {
return;
}
G.setColor(ZirkelFrame.IndicateColor);
G.setStroke(SuperThick);
G.draw(new Rectangle2D.Double(x, y, w, h));
G.setStroke(Normal);
}
@Override
public void drawLine(final double x, final double y, final double x1,
final double y1) {
if (test(x)||test(y)||test(x1)||test(y1)) {
return;
}
G.setStroke(Normal);
G.draw(new Line2D.Double(x, y, x1, y1));
}
@Override
public void drawThickLine(final double x, final double y, final double x1,
final double y1) {
if (test(x)||test(y)||test(x1)||test(y1)) {
return;
}
G.setStroke(Thick);
G.draw(new Line2D.Double(x, y, x1, y1));
G.setStroke(Normal);
}
public void drawMarkerLine(final double x, final double y, final double x1,
final double y1) {
if (test(x)||test(y)||test(x1)||test(y1)) {
return;
}
G.setColor(ZirkelFrame.IndicateColor);
G.setStroke(SuperThick);
G.draw(new Line2D.Double(x, y, x1, y1));
G.setStroke(Normal);
}
@Override
public void drawLine(final double x, final double y, final double x1,
final double y1, final ConstructionObject o) {
if (test(x)||test(y)||test(x1)||test(y1)) {
return;
}
G.draw(new Line2D.Double(x, y, x1, y1));
}
public boolean test(final double x) {
return Math.abs(x)>1e5;
}
@Override
public void drawArc(final double x, final double y, final double w,
final double h, final double a, final double b) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
}
G.setStroke(Normal);
G.draw(new Arc2D.Double(x, y, w, h, a, b, Arc2D.OPEN));
}
@Override
public void drawArc(final double x, final double y, final double w,
final double h, final double a, final double b,
final ConstructionObject o) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
} else {
G.draw(new Arc2D.Double(x, y, w, h, a, b, Arc2D.OPEN));
}
}
@Override
public FontMetrics getFontMetrics() {
return G.getFontMetrics();
}
private MyFormula TXF=null;
public void setTeXEqn(final String s) {
if (ZC==null) {
return;
}
if (TXF==null) {
try {
// Si la librairie JLaTeXMath est présente :
TXF=new MyTeXFormula(ZC, G);
} catch (Error e) {
// Sinon on passe au bon vieux HotEqn :
TXF=new MyHotEqnFormula(ZC, G);
}
}
TXF.setEquation(s);
}
public double paintTeXEqn(double c, double r) {
if (TXF==null) {
return 0;
}
G.setStroke(Normal);
return TXF.paint(c, r, G);
}
public double drawStringExtended(String s, final double x, final double y) {
Font myFont=G.getFont();
double w=0;
boolean isTeX=false;
String[] strs=computeString(s);
// Alternance texte-formule. La première boucle correspond à du texte,
// la deuxième à une formule TeX, troisième à du texte, etc... :
for (String mystr:strs){
if (isTeX){
setTeXEqn(mystr);
paintTeXEqn(x+w, y-TXF.getEquationAscent()+StrAsc);
w+=TXF.getEquationWidth();
}else{
G.setFont(myFont);
drawString(mystr, x+w, y+StrAsc);
w+=getFontMetrics().getStringBounds(mystr, G).getWidth();
}
isTeX=!isTeX;
}
return StrH;
}
private double StrH=0, StrW=0, StrAsc=0;
private String Str="";
private String[] Strs;
public String[] computeString(String s){
if (s.equals(Str)) {
return Strs;
}
Str=s;
Strs=s.split("\\$");
Font myFont=G.getFont();
StrAsc=0;
StrH=0;
StrW=0;
boolean isTeX=false;
// Alternance texte-formule :
for (String mystr:Strs){
if (isTeX){
setTeXEqn(mystr);
StrH=Math.max(StrH, TXF.getEquationHeight());
StrW+=TXF.getEquationWidth();
StrAsc= Math.max(StrAsc, TXF.getEquationAscent());
}else{
G.setFont(myFont);
StrH=Math.max(StrH, getFontMetrics().getStringBounds(mystr, G).getHeight());
StrW+=getFontMetrics().getStringBounds(mystr, G).getWidth();
StrAsc=Math.max(StrAsc, getFontMetrics().getLineMetrics(mystr, G).getAscent());
}
isTeX=!isTeX;
}
return Strs;
}
public double getW() {
return StrW;
}
@Override
public double stringWidth(final String s) {
computeString(s);
return StrW;
}
@Override
public double stringHeight(final String s) {
computeString(s);
return StrH;
}
@Override
public double stringAscent(final String s) {
computeString(s);
return StrAsc;
}
@Override
public void drawString(final String s, final double x, final double y) {
if (test(x)||test(y)) {
return;
}
G.drawString(s, (float) x, (float) y);
// G.drawString(AngleObject.translateToUnicode("éèéééer"), (float) x, (float) y);
}
@Override
public void drawOval(final double x, final double y, final double w,
final double h) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
}
G.setStroke(Normal);
G.draw(new Ellipse2D.Double(x, y, w, h));
}
@Override
public void drawOval(final double x, final double y, final double w,
final double h, final ConstructionObject o) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
} else {
G.draw(new Ellipse2D.Double(x, y, w, h));
}
}
@Override
public void drawCircle(final double x, final double y, final double r,
final ConstructionObject o) {
if (r>10*(W+H)) {
drawLargeCircleArc(x, y, r, 0, 360);
} else {
G.draw(new Ellipse2D.Double(x-r, y-r, 2*r, 2*r));
}
}
public void drawMarkerArc(final double x, final double y, final double r,
final double a, final double b) {
if (test(x)||test(y)||test(r)) {
return;
}
G.setColor(ZirkelFrame.IndicateColor);
G.setStroke(SuperThick);
G.draw(new Arc2D.Double(x-r, y-r, 2*r, 2*r, a, b, Arc2D.OPEN));
}
@Override
public void drawCircleArc(final double x, final double y, final double r,
final double a, final double b, final ConstructionObject o) {
if (r>10*(W+H)) {
drawLargeCircleArc(x, y, r, a, b);
} else {
G.draw(new Arc2D.Double(x-r, y-r, 2*r, 2*r, a, b,
Arc2D.OPEN));
}
}
void drawLargeCircleArc(final double x, final double y, final double r,
final double a, final double b) {
if (r>1E10) {
return;
}
final double dw=Math.sqrt((W+H)/r/10);
double w=a;
double x0=x+r*Math.cos(w/180*Math.PI);
double y0=y-r*Math.sin(w/180*Math.PI);
w=w+dw;
while (w<a+b+dw) {
if (w>a+b) {
w=a+b;
}
final double x1=x+r*Math.cos(w/180*Math.PI);
final double y1=y-r*Math.sin(w/180*Math.PI);
final double dx=(x0+x1)/2, dy=(y0+y1)/2;
if (Math.sqrt(dx*dx+dy*dy)<=10*(W+H)) {
G.draw(new Line2D.Double(x0, y0, x1, y1));
}
x0=x1;
y0=y1;
w+=dw;
}
}
@Override
public void fillRect(final double x, final double y, final double w,
final double h, final boolean outline, final boolean transparent,
final ConstructionObject o) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
}
setFillColor(o);
Color oldC=G.getColor();
int alpha=(transparent&&!o.isSolid())?128:255;
Color c=new Color(oldC.getRed(), oldC.getGreen(), oldC.getBlue(), alpha);
G.setColor(c);
G.fill(new Rectangle2D.Double(x, y, w, h));
G.setColor(oldC);
if (outline) {
setColor(o);
G.draw(new Rectangle2D.Double(x, y, w, h));
}
}
@Override
public void fillOval(final double x, final double y, final double w,
final double h, final boolean outline, final boolean transparent,
final ConstructionObject o) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
}
if (o.getColorType()!=ConstructionObject.INVISIBLE) {
setFillColor(o);
Color oldC=G.getColor();
int alpha=(transparent&&!o.isSolid())?128:255;
Color c=new Color(oldC.getRed(), oldC.getGreen(), oldC.getBlue(), alpha);
G.setColor(c);
try {
G.fill(new Ellipse2D.Double(x, y, w, h));
} catch (final Exception e) {
}
G.setColor(oldC);
}
if (outline) {
setColor(o);
drawOval(x, y, w, h);
}
}
@Override
public void fillArc(final double x, final double y, final double w,
final double h, final double a, final double b,
final boolean outline, final boolean transparent,
final boolean arcb, final ConstructionObject o) {
if (test(x)||test(y)||test(w)||test(h)) {
return;
}
setFillColor(o);
Color oldC=G.getColor();
int alpha=(transparent&&!o.isSolid())?128:255;
Color c=new Color(oldC.getRed(), oldC.getGreen(), oldC.getBlue(), alpha);
G.setColor(c);
final Arc2D arc=new Arc2D.Double(x, y, w, h, a, b, arcb?Arc2D.PIE
:Arc2D.CHORD);
G.fill(arc);
G.setColor(oldC);
if (outline) {
setColor(o);
arc.setArcType(Arc2D.OPEN);
G.setStroke(Normal);
G.draw(arc);
}
}
int xx[]=new int[64], yy[]=new int[64];
@Override
public void fillPolygon(final double x[], final double y[], final int n,
final boolean outline, final boolean transparent,
final ConstructionObject o) {
if (n<1) return;
Path2D path=new Path2D.Double();
path.moveTo(x[0], y[0]);
for (int i=1;i<n;i++) {
path.lineTo(x[i], y[i]);
}
path.lineTo(x[0], y[0]);
if (o.getColorType()!=ConstructionObject.INVISIBLE) {
setFillColor(o);
Color oldC=G.getColor();
int alpha=(transparent&&!o.isSolid())?128:255;
Color c=new Color(oldC.getRed(), oldC.getGreen(), oldC.getBlue(), alpha);
G.setColor(c);
G.fill(path);
G.setColor(oldC);
}
if (outline) {
setColor(o);
G.setStroke(Normal);
G.draw(path);
}
}
// Uniquement appelée par AreaObject :
@Override
public void fillPolygon(final double x[], final double y[], final int n,
final ConstructionObject o) {
if (n<1) return;
Path2D path=new Path2D.Double();
path.moveTo(x[0], y[0]);
for (int i=1;i<n;i++) {
path.lineTo(x[i], y[i]);
}
path.lineTo(x[0], y[0]);
if (o.isFilled()) {
// Petite modif de code. On passe aux couleurs avec transparence plutôt qu'utiliser
// le setComposite :
setFillColor(o);
Color oldC=G.getColor();
int alpha=((o.getColorType()!=ConstructionObject.THICK)&&(!o.isSolid()))?128:255;
Color c=new Color(oldC.getRed(), oldC.getGreen(), oldC.getBlue(), alpha);
G.setColor(c);
G.fill(path);
G.setColor(oldC);
}
if (!o.isFilled()||o.indicated()||o.selected()
||o.getColorType()==ConstructionObject.NORMAL) {
setColor(o);
if (o.indicated()||o.selected()) {
G.setStroke(Normal);
} else {
if (o.getColorType()==ConstructionObject.THIN) {
G.setStroke(Thin);
} else if (o.getColorType()==ConstructionObject.THICK) {
G.setStroke(Thick);
} else {
G.setStroke(Normal);
}
}
G.draw(path);
}
}
@Override
public void drawImage(final Image i, final int x, final int y,
final ImageObserver o) {
G.drawImage(i, x, y, o);
}
@Override
public void drawImage(final Image i, final int x, final int y, final int w,
final int h, final ImageObserver o) {
G.drawImage(i, x, y, w, h, o);
}
FontStruct FS=new FontStruct();
@Override
public void setDefaultLineSize(double graphicsLineSize) {
final float dash[]={(float) (graphicsLineSize*5.0), (float) (graphicsLineSize*5.0)};
Thin=new BasicStroke((float) (graphicsLineSize), BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
Normal=new BasicStroke((float) (graphicsLineSize), BasicStroke.CAP_ROUND,
BasicStroke.JOIN_MITER);
Thick=new BasicStroke((float) (graphicsLineSize*2.0), BasicStroke.CAP_ROUND,
BasicStroke.JOIN_MITER);
DCross=new BasicStroke((float) (graphicsLineSize*3.0),
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
DCrossNormal=new BasicStroke((float) (graphicsLineSize*1.5),
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
SuperThick=new BasicStroke((float) (20), BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND);
}
@Override
public void setFont(double h, final boolean bold) {
Font f=FS.getFont(h, bold);
if (f!=null) {
G.setFont(f);
} else {
if (G instanceof VectorGraphics2D) {
f=new Font("Arial",
bold?Font.BOLD:Font.PLAIN, (int)h);
f=f.deriveFont((float)h);
} else {
f=new Font(Global.getParameter("font.name", "dialog"),
bold?Font.BOLD:Font.PLAIN, (int)h);
f=f.deriveFont((float)h);
}
// f=new Font(Global.getParameter("font.name", "dialog"),
// bold?Font.BOLD:Font.PLAIN, h);
FS.storeFont(h, bold, f);
G.setFont(f);
}
}
double fsize;
boolean flarge, fbold;
int ffactor=Global.getParameter("ffactor", 130);
@Override
public void setDefaultFont(double h, final boolean large,
final boolean bold) {
ffactor=Global.getParameter("ffactor", 130);
fsize=h;
flarge=large;
fbold=bold;
setFont(large, bold);
}
@Override
public void setFont(final boolean large, final boolean bold) {
double size=fsize;
// int size=eric.JGlobals.FixFontSize(fsize);
if (large) {
size=size*ffactor/100;
}
if (flarge) {
size=size*ffactor/100;
}
setFont(size, bold||fbold);
}
@Override
public void drawImage(final Image i, final double x, final double y,
final double x1, final double y1, final double x2, final double y2,
final ImageObserver o) {
try {
final int w=i.getWidth(o), h=i.getHeight(o);
final AffineTransform AT=new AffineTransform((x1-x)/w,
(y1-y)/w, (x2-x)/h, (y2-y)/h, x, y);
G.drawImage(i, AT, o);
} catch (final Exception e) {
}
}
@Override
public Graphics getGraphics() {
return G;
}
@Override
public void fillOval(final double x, final double y, final double w,
final double h, final Color WithColor) {
try {
G.setColor(WithColor);
G.fill(new Ellipse2D.Double(x, y, w, h));
} catch (final Exception e) {
}
}
@Override
public void fillRect(final double x, final double y, final double w,
final double h, final Color WithColor) {
try {
G.setColor(WithColor);
G.fill(new Rectangle2D.Double(x, y, w, h));
} catch (final Exception e) {
}
}
@Override
public void drawDiamond(final double x, final double y, final double w,
final boolean isThick, final ConstructionObject o) {
AffineTransform aT=G.getTransform();
Rectangle2D r=new Rectangle2D.Double(x, y, w, w);
AffineTransform rotate45=AffineTransform.getRotateInstance(Math.PI/4, x+w/2, y+w/2);
G.transform(rotate45);
if (isThick) {
setColor(o);
} else {
G.setColor(new Color(250, 250, 250));
}
G.fill(r);
if (!isThick) {
setColor(o);
G.draw(r);
}
G.setTransform(aT);
// final double dw=w/2;
// final int dx[]=new int[4], dy[]=new int[4];
// dx[0]=(int) (x+dw);
// dy[0]=(int) (y);
// dx[1]=(int) (x+w);
// dy[1]=(int) (y+dw);
// dx[2]=(int) (x+dw);
// dy[2]=(int) (y+w);
// dx[3]=(int) (x);
// dy[3]=(int) (y+dw);
// if (isThick) {
// setColor(o);
// } else {
// G.setColor(new Color(250, 250, 250));
// }
// G.fillPolygon(dx, dy, 4);
// if (!isThick) {
// setColor(o);
// G.drawPolygon(dx, dy, 4);
// }
}
@Override
public void drawDcross(final double x, final double y, final double w,
final boolean isThick, final ConstructionObject o) {
final double x1=x+w, y1=y+w;
setColor(o);
if (isThick) {
G.setStroke(DCross);
} else {
G.setStroke(DCrossNormal);
}
G.draw(new Line2D.Double(x, y, x1, y1));
G.draw(new Line2D.Double(x, y1, x1, y));
G.setStroke(Normal);
}
@Override
public void setAntialiasing(final boolean bool) {
if (bool) {
G.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// G.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
} else {
G.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
// G.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
// RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
}
}
@Override
public void drawAxisLine(final double x, final double y, final double x1,
final double y1, float thickness) {
if (test(x)||test(y)||test(x1)||test(y1)) {
return;
}
// G.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
// RenderingHints.VALUE_STROKE_NORMALIZE);
// G.setStroke(new BasicStroke(thickness));
G.setStroke(new BasicStroke(thickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
G.draw(new Line2D.Double(x, y, x1, y1));
G.setStroke(Normal);
// G.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
// RenderingHints.VALUE_STROKE_PURE);
}
}

View file

@ -0,0 +1,26 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.graphics;
import java.awt.Graphics2D;
/**
*
* @author erichake
*/
public abstract class MyFormula {
protected float EQwidth=0f, EQheight=0f;
protected float EQbaseLine=0f;
public abstract void setEquation(String s);
public abstract double getEquationWidth();
public abstract double getEquationHeight();
public abstract double getEquationAscent();
public abstract String getEquation();
public abstract double paint(double c, double r, Graphics2D g);
}

View file

@ -0,0 +1,143 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.ImageObserver;
import rene.zirkel.objects.ConstructionObject;
public abstract class MyGraphics {
double W = 1000, H = 1000;
public void setSize(final double w, final double h) {
W = w;
H = h;
}
public abstract void clearRect(int x, int y, int w, int h, Color c);
public abstract void setColor(Color c);
public abstract void setColor(ConstructionObject o);
public abstract void setFillColor(ConstructionObject o);
public abstract void setLabelColor(ConstructionObject o);
public abstract void drawRect(double x, double y, double w, double h);
public abstract void drawAxisLine(double x, double y, double x1, double y1, float thickness);
public abstract void drawLine(double x, double y, double x1, double y1,
ConstructionObject o);
public abstract void drawLine(double x, double y, double x1, double y1);
public abstract void drawThickLine(double x, double y, double x1, double y1);
public abstract void drawArc(double x, double y, double w, double h,
double a, double b);
public abstract void drawArc(double x, double y, double w, double h,
double a, double b, ConstructionObject o);
public void drawCircleArc(final double x, final double y, final double r,
final double a, final double b, final ConstructionObject o) {
drawArc(x - r, y - r, 2 * r, 2 * r, a, b, o);
}
// public abstract int drawLaTeXString(String s, double x, double y);
public abstract void drawString(String s, double x, double y);
public abstract void drawOval(double x, double y, double w, double h);
public abstract void drawOval(double x, double y, double w, double h,
ConstructionObject o);
public void drawCircle(final double x, final double y, final double r,
final ConstructionObject o) {
drawOval(x - r, y - r, 2 * r, 2 * r, o);
}
public abstract void fillRect(double x, double y, double w, double h,
boolean outline, boolean transparent, ConstructionObject o);
public abstract void fillRect(double x, double y, double w, double h,
Color WithColor);
public abstract void fillOval(double x, double y, double w, double h,
boolean outline, boolean transparent, ConstructionObject o);
public abstract void fillOval(double x, double y, double w, double h,
Color WithColor);
public abstract void fillPolygon(double x[], double y[], int n,
boolean outline, boolean tranparent, ConstructionObject o);
public abstract void fillPolygon(double x[], double y[], int n,
ConstructionObject o);
public abstract void drawDiamond(double x, double y, double w,
boolean isThick, ConstructionObject o);
public abstract void drawDcross(double x, double y, double w,
boolean isThick, ConstructionObject o);
public abstract void fillArc(double x, double y, double w, double h,
double a, double b, boolean outline, boolean transparent,
boolean arc, ConstructionObject o);
public abstract void drawImage(Image i, int x, int y, ImageObserver o);
public abstract void drawImage(Image i, int x, int y, int w, int h,
ImageObserver o);
public abstract void drawImage(Image i, double x, double y, double x1,
double y1, double x2, double y2, ImageObserver o);
public abstract void setDefaultFont(double size, boolean large, boolean bold);
public abstract void setDefaultLineSize(double graphicsLineSize);
public abstract void setFont(boolean large, boolean bold);
public abstract void setFont(double size, boolean bold);
public abstract FontMetrics getFontMetrics();
public abstract Graphics getGraphics();
public abstract double stringAscent(String s);
public abstract double stringWidth(String s);
public abstract double stringHeight(String s);
public abstract double drawStringExtended(String s, double x, double y);
public abstract void setAntialiasing(boolean bool);
}

View file

@ -0,0 +1,58 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.graphics;
import atp.sHotEqn;
import java.awt.Graphics2D;
import rene.zirkel.ZirkelCanvas;
/**
*
* @author erichake
*/
public class MyHotEqnFormula extends MyFormula {
private sHotEqn HE=null;
private String EQ="";
private ZirkelCanvas ZC;
private Graphics2D G=null;
public MyHotEqnFormula(ZirkelCanvas zc, Graphics2D g) {
ZC=zc;
G=g;
HE=new sHotEqn(ZC);
}
@Override
public void setEquation(String s) {
EQ=s;
HE.setEquation(s);
EQwidth=HE.getSizeof(HE.getEquation(), G).width;
EQheight=HE.getSizeof(HE.getEquation(), G).height;
EQbaseLine=HE.getAscent(HE.getEquation(), G);
}
public double getEquationWidth() {
return EQwidth;
}
public double getEquationHeight() {
return EQheight;
}
public double getEquationAscent() {
double d=EQbaseLine;
return d;
}
public String getEquation() {
return EQ;
}
@Override
public double paint(double c, double r, Graphics2D g) {
return HE.paint((int)c, (int)r, G);
}
}

View file

@ -0,0 +1,107 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.graphics;
import de.erichseifert.vectorgraphics2d.VectorGraphics2D;
import de.erichseifert.vectorgraphics2d.VectorGraphics2D.FontRendering;
import java.awt.Graphics2D;
import org.scilab.forge.jlatexmath.Box;
import org.scilab.forge.jlatexmath.DefaultTeXFont;
import org.scilab.forge.jlatexmath.StrutBox;
import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXEnvironment;
import org.scilab.forge.jlatexmath.TeXFormula;
import rene.zirkel.ZirkelCanvas;
/**
*
* @author erichake
*/
public class MyTeXFormula extends MyFormula {
private TeXFormula JTeX=null;
private String EQ="";
private ZirkelCanvas ZC;
private Graphics2D G=null;
private boolean parseError=false;
public MyTeXFormula(ZirkelCanvas zc, Graphics2D g) {
ZC=zc;
G=g;
try {
JTeX=new TeXFormula();
} catch (Exception e) {
JTeX=null;
}
}
public MyTeXIcon createTeXIcon(int style, float size) {
TeXEnvironment te=new TeXEnvironment(style, new DefaultTeXFont(size));
Box box;
if (JTeX.root==null) {
box=new StrutBox(0, 0, 0, 0);
} else {
box=JTeX.root.createBox(te);
}
MyTeXIcon ti=new MyTeXIcon(box, size);
ti.isColored=te.isColored;
return ti;
}
public void setEquation(String s) {
EQ=s;
try {
JTeX.setLaTeX(s);
MyTeXIcon icon=createTeXIcon(TeXConstants.STYLE_DISPLAY, (float) ZC.fontSize());
EQwidth=icon.getTrueIconWidth();
EQheight=icon.getTrueIconHeight();
EQbaseLine=icon.getBaseLine();
parseError=false;
} catch (Exception e) {
EQwidth=0;
EQheight=0;
EQbaseLine=0;
parseError=true;
System.out.println("jlatexmath.ParseException");
}
}
public double getEquationWidth() {
return EQwidth;
}
public double getEquationHeight() {
return EQheight;
}
public double getEquationAscent() {
double d=EQheight*EQbaseLine;
return d;
}
public String getEquation() {
return EQ;
}
public double paint(double c, double r, Graphics2D g) {
if (parseError) {
return 0;
}
float col=(float) c;
float row=(float) r;
JTeX.setColor(g.getColor());
MyTeXIcon icon=createTeXIcon(org.scilab.forge.jlatexmath.TeXConstants.STYLE_DISPLAY, (float) ZC.fontSize());
if (g instanceof VectorGraphics2D) {
VectorGraphics2D vg2d=(VectorGraphics2D) g;
FontRendering oldFontRendering=vg2d.getFontRendering();
vg2d.setFontRendering(VectorGraphics2D.FontRendering.VECTORS);
icon.paintIcon(null, g, col, row);
vg2d.setFontRendering(oldFontRendering);
} else {
icon.paintIcon(null, g, col, row);
}
return icon.getTrueIconHeight();
}
}

View file

@ -0,0 +1,74 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.graphics;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import org.scilab.forge.jlatexmath.Box;
import org.scilab.forge.jlatexmath.TeXIcon;
/**
*
* @author erichake
*/
public class MyTeXIcon extends TeXIcon {
Box box;
private final float size;
private Insets insets = new Insets(0, 0, 0, 0);
private Color fg = new Color(0, 0, 0);
protected MyTeXIcon(Box b, float size) {
super(b,size,true);
box = b;
if (defaultSize != -1) {
size = defaultSize;
}
if (magFactor != 0) {
this.size = size * Math.abs(magFactor);
} else {
this.size = size;
}
}
public void paintIcon(Component c, Graphics g, float x, float y) {
Graphics2D g2 = (Graphics2D) g;
// copy graphics settings
RenderingHints oldHints = g2.getRenderingHints();
AffineTransform oldAt = g2.getTransform();
Color oldColor = g2.getColor();
// new settings
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.scale(size, size); // the point size
g2.setColor(c != null ? c.getForeground() : fg); // foreground will be used as default painting color
// draw formula box
box.draw(g2,x/size, y /size+box.getHeight());
// restore graphics settings
g2.setRenderingHints(oldHints);
g2.setTransform(oldAt);
g2.setColor(oldColor);
}
@Override
public float getBaseLine() {
return ( box.getHeight() /(box.getHeight()+box.getDepth()));
}
}

View file

@ -0,0 +1,146 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import rene.zirkel.objects.ConstructionObject;
/**
* @author Rene
*
*/
public class PolygonDrawer {
MyGraphics G;
ConstructionObject O;
double C, R;
double oldR=Double.NaN;
double C1, R1;
boolean HaveToFinish;
// private double step=9.0;
private double maxGap=20;
public boolean Marker=false;
public boolean Started;
boolean Solid;
boolean haveToCheckDiscontinuity;
public PolygonDrawer(boolean checkDiscontinuity, final MyGraphics g, final ConstructionObject o) {
G=g;
O=o;
Started=false;
haveToCheckDiscontinuity=checkDiscontinuity;
// step=9.0*O.getConstruction().getOne()*O.getConstruction().getOne();
maxGap=20*O.getConstruction().getOne();
}
public boolean isLineOnDiscontinuity(final double c, final double r) {
if ((!haveToCheckDiscontinuity)||(Double.isNaN(oldR))) {
return false;
}
if (((R-oldR)*(r-R))<0) { // Si il y a changement de signe de la "dérivée"
if (Math.abs(r-R)>maxGap) { // Et si en plus le "trou" est trop grand
finishPolygon();
startPolygon(c, r); // On commence un nouveau polygone
return true;
}
}
return false;
}
public void startPolygon(final double c, final double r) {
C=c;
R=r;
oldR=Double.NaN;
HaveToFinish=false;
Started=true;
}
// public void drawTo(final double c, final double r, final boolean dodraw) {
// if (!Started) {
// startPolygon(c, r);
// return;
// }
// if (!isLineOnDiscontinuity(c, r)) {
// if (dodraw||(c-C)*(c-C)+(r-R)*(r-R)>step) {
// if (Marker) {
// ((MainGraphics) G).drawMarkerLine(C, R, c, r);
// } else {
// G.drawLine(C, R, c, r, O);
// }
// oldR=R;
// C=c;
// R=r;
// HaveToFinish=false;
// } else {
//
// C1=c;
// R1=r;
// HaveToFinish=true;
// }
// }
// }
public void drawTo(final double c, final double r) {
// drawTo(c, r, false);
if (!Started) {
startPolygon(c, r);
return;
}
if (!isLineOnDiscontinuity(c, r)) {
if (Marker) {
((MainGraphics) G).drawMarkerLine(C, R, c, r);
} else {
G.drawLine(C, R, c, r, O);
}
oldR=R;
C=c;
R=r;
HaveToFinish=false;
}
}
public void finishPolygon() {
if (HaveToFinish) {
if (Marker) {
((MainGraphics) G).drawMarkerLine(C, R, C1, R1);
} else {
G.drawLine(C, R, C1, R1, O);
}
HaveToFinish=false;
}
Started=false;
}
public boolean hasStarted() {
return Started;
}
public double c() {
return C;
}
public double r() {
return R;
}
public void useAsMarker() {
Marker=true;
// step=18;
}
}

View file

@ -0,0 +1,124 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import rene.zirkel.objects.ConstructionObject;
/**
* @author Rene
*
*/
public class PolygonFiller {
MyGraphics G;
ConstructionObject O;
double C, R;
double C1, R1;
boolean HaveToFinish;
public static int step = 5;
public boolean Started;
boolean Solid;
double x[], y[];
int nx;
public PolygonFiller(final MyGraphics g, final ConstructionObject o) {
G = g;
O = o;
Started = false;
}
public void startPolygon(final double c, final double r) {
C = c;
R = r;
HaveToFinish = false;
nx = 0;
Started = true;
drawTo(c, r, false);
}
public void start() {
nx = 0;
Started = false;
}
public void drawTo(final double c, final double r) {
drawTo(c, r, true);
}
public void drawTo(final double c, final double r, final boolean optimized) {
if (!Started) {
startPolygon(c, r);
return;
}
if (!optimized || (c - C) * (c - C) + (r - R) * (r - R) > step) {
if (x == null) {
x = new double[1000];
y = new double[1000];
nx = 0;
}
if (nx >= x.length) {
final double xn[] = new double[2 * x.length];
final double yn[] = new double[2 * x.length];
for (int i = 0; i < nx; i++) {
xn[i] = x[i];
yn[i] = y[i];
}
x = xn;
y = yn;
}
x[nx] = c;
y[nx++] = r;
C = c;
R = r;
HaveToFinish = false;
} else {
C1 = c;
R1 = r;
HaveToFinish = true;
}
}
public void finishPolygon() {
if (HaveToFinish) {
drawTo(C1, R1, false);
HaveToFinish = false;
}
G.fillPolygon(x, y, nx, false, true, O);
Started = false;
}
public int length() {
return nx;
}
public double x(final int i) {
return x[i];
}
public double y(final int i) {
return y[i];
}
public void setGraphics(final MyGraphics g) {
G = g;
}
}

View file

@ -0,0 +1,33 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.graphics;
import java.util.Enumeration;
import rene.zirkel.ZirkelCanvas;
public interface TrackPainter {
public Enumeration elements();
public void paint(MyGraphics g, ZirkelCanvas zc);
public void validate(ZirkelCanvas zc);
}

BIN
rene/zirkel/icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

BIN
rene/zirkel/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -0,0 +1,29 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.listener;
import rene.zirkel.construction.Construction;
import rene.zirkel.objects.ConstructionObject;
public interface AddEventListener {
public void added(Construction c, ConstructionObject o);
}

View file

@ -0,0 +1,30 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.listener;
// file: CloseListener.java
import java.awt.Frame;
public interface CloseListener {
public void closed(Frame f);
}

View file

@ -0,0 +1,26 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.listener;
public interface DoneListener {
public void notifyDone();
}

View file

@ -0,0 +1,26 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.listener;
public interface StatusListener {
void showStatus(String s);
}

BIN
rene/zirkel/logowindow.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
rene/zirkel/macro/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,375 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.macro;
import java.util.Enumeration;
import java.util.Vector;
import rene.util.xml.XmlTag;
import rene.util.xml.XmlTagText;
import rene.util.xml.XmlTree;
import rene.util.xml.XmlWriter;
import rene.zirkel.ZirkelCanvas;
import rene.zirkel.construction.Construction;
import rene.zirkel.construction.ConstructionException;
import rene.zirkel.objects.ConstructionObject;
/**
* Macros are stored as constructions. Some of the construction objects are
* parameters, which divide into two groups: primary parapemers and secondary
* parameters (e.g. endpoints of a segment). Moreover, there is a separate list
* of the primary parameters and the prompts to display to the user at each
* primary parameter. Some objects are marked as targets.
*/
public class Macro extends Construction implements Cloneable {
public String Name;
public String Prompts[];
public ConstructionObject Params[];
public String PromptFor[] = new String[0];
public String PromptName[] = new String[0];
public String LastParams[];
public boolean Fixed[];
// public boolean createDPLineObjects=false;
boolean Protected = false;
boolean HideDuplicates = true;
// Macro renvoyant un dp_mode (voir la classe ConstructionObject).
// 0 pour un objet non-DP, sinon
// ConstructionObject.DP_LINE ou ConstructionObject.DP_SEGMENT :
public int createDPObjects=0;
/**
* @param zc
* The ZirkelCanvas.
* @param name
* The name of this macro
* @param comment
* The macro comment.
* @param e
* The parameter prompt strings.
*/
public Macro(final ZirkelCanvas zc, final String name,
final String comment, final String s[]) {
Name = name;
Comment = comment;
Prompts = s;
}
public String getName() {
return Name;
}
public void setName(final String name) {
Name = name;
}
@Override
public String getComment() {
return Comment;
}
public String[] getPrompts() {
return Prompts;
}
/**
* Set the list of parameters. The setup of the macro is done in a function
* in ZirkelCanvas.defineMacro().
*/
public void setParams(final ConstructionObject p[]) {
Params = p;
}
public ConstructionObject[] getParams() {
return Params;
}
/**
* Denote and recall previously set parameters.
*/
public void initLast() {
LastParams = new String[Params.length];
}
public void setLast(final String name, final int i) {
try {
LastParams[i] = name;
} catch (final Exception e) {
}
}
public String getLast(final int i) {
if (LastParams != null && LastParams[i] != null)
return LastParams[i];
else
return "";
}
public void setPromptFor(final String s[]) {
PromptFor = s;
PromptName = new String[PromptFor.length];
for (int i = 0; i < PromptFor.length; i++)
PromptName[i] = PromptFor[i];
}
public void setPromptName(final int i, final String s) {
PromptName[i] = s;
}
public boolean promptFor(final String s) {
return getPromptFor(s) >= 0;
}
public int getPromptFor(final String s) {
for (int i = 0; i < PromptFor.length; i++)
if (PromptFor[i].equals(s))
return i;
return -1;
}
public String getPromptName(final String s) {
for (int i = 0; i < PromptFor.length; i++)
if (PromptFor[i].equals(s))
return PromptName[i];
return "";
}
public int countPrompts() {
return PromptFor.length;
}
/**
* Save a macro.
*/
public void saveMacro(final XmlWriter xml) { // Start the macro with its
// name as parameter
xml.startTagStart("Macro");
xml.printArg("Name", Name);
if (!HideDuplicates)
xml.printArg("showduplicates", "true");
xml.startTagEndNewLine();
// Write the parameters and their prompts
for (int i = 0; i < Params.length; i++) {
xml.startTagStart("Parameter");
xml.printArg("name", Params[i].getName());
if (Fixed != null && Fixed[i] && LastParams != null
&& LastParams[i] != null)
xml.printArg("fixed", LastParams[i]);
xml.startTagEnd();
xml.print(Prompts[i]);
xml.endTagNewLine("Parameter");
}
// Write a comment
if (!getComment().equals("")) {
xml.startTagNewLine("Comment");
xml.printParagraphs(getComment(), 60);
xml.endTagNewLine("Comment");
}
// Write the objects. I.e., secondary parameters, primary
// parameters and constructed things, including targets as in
// any other construction.
xml.startTagNewLine("Objects");
save(xml);
xml.endTagNewLine("Objects");
// Save the objects prompted for
if (PromptFor.length > 0) {
xml.startTagStart("PromptFor");
for (int i = 0; i < PromptFor.length; i++) {
xml.printArg("object" + i, PromptFor[i]);
xml.printArg("prompt" + i, PromptName[i]);
}
xml.finishTagNewLine();
}
// End the macro
xml.endTagNewLine("Macro");
}
/**
* Read a macro (implemented as a constructor).
*/
public Macro(final ZirkelCanvas zc, XmlTree tree)
throws ConstructionException { // See, if this is a macro tree, and
// has a name.
XmlTag tag = tree.getTag();
if (!tag.name().equals("Macro"))
throw new ConstructionException("No macro!");
if (!tag.hasParam("Name"))
throw new ConstructionException("Name missing!");
Name = tag.getValue("Name");
if (tag.hasParam("showduplicates"))
HideDuplicates = false;
// Walk through content
Enumeration e = tree.getContent();
while (e.hasMoreElements()) {
final XmlTree t = (XmlTree) e.nextElement();
tag = t.getTag();
// Read the objects, the comment
if (tag.name().equals("Objects")) // Objects
{
readConstruction(t, false);
break;
} else if (tag.name().equals("Comment")) // Comment
{
try {
setComment(t.parseComment());
} catch (final Exception ex) {
throw new ConstructionException("Illegal Comment");
}
}
}
// Read the parameters.
int ParamCount = 0;
// First count the paramters.
e = tree.getContent();
while (e.hasMoreElements()) {
final XmlTree t = (XmlTree) e.nextElement();
tag = t.getTag();
if (tag.name().equals("Parameter")) {
if (!tag.hasParam("name"))
throw new ConstructionException("Parameter name missing!");
ParamCount++;
} else if (tag.name().equals("PromptFor")) {
if (tag.hasParam("object")) {
final String s[] = new String[1];
s[0] = tag.getValue("object");
setPromptFor(s);
if (tag.hasParam("prompt"))
setPromptName(0, tag.getValue("prompt"));
} else {
int n = 0;
while (tag.hasParam("object" + n))
n++;
final String s[] = new String[n];
for (int i = 0; i < n; i++) {
s[i] = tag.getValue("object" + i);
}
setPromptFor(s);
for (int i = 0; i < n; i++) {
if (tag.hasParam("prompt" + i))
setPromptName(i, tag.getValue("prompt" + i));
}
}
}
}
// Then read the parameters.
Params = new ConstructionObject[ParamCount];
initLast();
Prompts = new String[ParamCount];
for (int pr = 0; pr < ParamCount; pr++)
Prompts[pr] = "";
int i = 0;
e = tree.getContent();
while (e.hasMoreElements()) {
final XmlTree t = (XmlTree) e.nextElement();
tag = t.getTag();
if (tag.name().equals("Parameter")) { // Search a parameter by this
// name
Params[i] = find(tag.getValue("name"));
if (Params[i] == null)
throw new ConstructionException("Illegal parameter "
+ tag.getValue("name") + "!");
if (tag.hasParam("fixed")) {
if (Fixed == null) {
Fixed = new boolean[ParamCount];
for (int j = 0; j < ParamCount; j++)
Fixed[j] = false;
}
Fixed[i] = true;
LastParams[i] = tag.getValue("fixed");
}
final Enumeration en = t.getContent();
while (en.hasMoreElements()) {
tree = (XmlTree) en.nextElement();
if (tree.getTag() instanceof XmlTagText) {
Prompts[i] = ((XmlTagText) tree.getTag()).getContent();
}
}
i++;
}
}
}
/**
* @return A list of targets.
*/
@Override
public Vector getTargets() {
final Vector v = new Vector();
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final ConstructionObject o = (ConstructionObject) e.nextElement();
if (o.isTarget())
v.addElement(o);
}
return v;
}
public boolean hasFixed() {
for (final String prompt : Prompts)
if (prompt.startsWith("="))
return true;
if (Fixed == null)
return false;
for (final boolean element : Fixed)
if (element)
return true;
return false;
}
public boolean isFixed(final int i) {
if (Fixed == null)
return false;
return Fixed[i];
}
public void setFixed(final int i, final boolean f) {
if (Fixed == null)
return;
Fixed[i] = f;
}
@Override
public Object clone() {
try {
return super.clone();
} catch (final Exception e) {
}
return null;
}
public boolean isProtected() {
return Protected;
}
public void setProtected(final boolean flag) {
Protected = flag;
}
public boolean hideDuplicates() {
return HideDuplicates;
}
public void hideDuplicates(final boolean flag) {
HideDuplicates = flag;
}
}

View file

@ -0,0 +1,104 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.macro;
import java.awt.Frame;
import java.util.Enumeration;
import java.util.Vector;
import rene.gui.Global;
import rene.gui.IconBar;
class MacroBarElement {
public MacroItem M;
public String Name;
public MacroBarElement(final MacroItem m, final String name) {
M = m;
Name = name;
}
}
public class MacroBar extends IconBar {
/**
*
*/
private static final long serialVersionUID = 1L;
Vector V = new Vector();
public MacroBar(final Frame f) {
super(f, false);
Resource = "/icons/";
}
public void update(final Vector macros) {
removeAll();
V.removeAllElements();
final Enumeration e = macros.elements();
while (e.hasMoreElements()) {
final MacroItem m = (MacroItem) e.nextElement();
final String name = m.Name;
if (name.endsWith(")")
&& (!m.M.isProtected() || Global.getParameter(
"defaultmacrosinbar", true))) {
addToggleLeft(name);
V.addElement(new MacroBarElement(m, name));
}
}
doLayout();
forceRepaint();
}
public void deselectAll() {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final MacroBarElement me = (MacroBarElement) e.nextElement();
setState(me.Name, false);
}
}
public Macro find(final String o) {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final MacroBarElement me = (MacroBarElement) e.nextElement();
if (me.Name.equals(o)) {
return me.M.M;
}
}
return null;
}
public void select(final Macro m) {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final MacroBarElement me = (MacroBarElement) e.nextElement();
if (me.M.M == m) {
setState(me.Name, true);
}
}
}
@Override
public String getHelp(final String name) {
return name;
}
}

View file

@ -0,0 +1,48 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package rene.zirkel.macro;
import eric.JZirkelCanvas;
import eric.macros.CreateMacroDialog;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import rene.gui.Global;
/**
*
* @author erichake
*/
public class MacroContextualPopupMenu extends PopupMenu {
static MenuItem newmacro;
public MacroContextualPopupMenu() {
super();
addNewItem();
}
public void addNewItem() {
newmacro=new MenuItem(Global.Loc("palette.info.newmacro"));
newmacro.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new CreateMacroDialog(JZirkelCanvas.getNewMacroPanel());
JZirkelCanvas.ActualiseMacroPanel();
}
});
add(newmacro);
addSeparator();
}
@Override
public void removeAll() {
super.removeAll();
addNewItem();
}
}

View file

@ -0,0 +1,44 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.macro;
// file: ZirkelCanvas.java
import java.awt.MenuItem;
import rene.util.sort.SortObject;
public class MacroItem implements SortObject {
public MenuItem I;
public Macro M;
public String Name;
public MacroItem(final Macro m, final MenuItem i) {
M = m;
I = i;
}
public int compare(final SortObject o) {
final MacroItem mio = (MacroItem) o;
return -mio.M.Name.compareTo(M.Name);
}
}

View file

@ -0,0 +1,196 @@
/*
Copyright 2006 Rene Grothmann, modified by Eric Hakenholz
This file is part of C.a.R. software.
C.a.R. is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
C.a.R. 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 rene.zirkel.macro;
import java.awt.Menu;
import java.util.Enumeration;
import java.util.Vector;
import rene.gui.MyMenu;
import rene.gui.MyMenuItem;
public class MacroMenu {
Vector V; // Vector of MacroMenu or MacroItem
Menu FatherMenu; // awt.Menu containing this MacroMenu
String Name; // Name of this MacroMenu (as displayed in the Menu)
MacroMenu Father;
public MacroMenu(final Menu o, final String name, final MacroMenu father) {
V = new Vector();
FatherMenu = o;
Name = name;
Father = father;
}
/**
* Add a macro this menu. This is a recursive function! Macros may have a
* macro path with them.
*
* @param m
* Macro to add
* @param name
* Name for the macro (inclusive path)
* @return MyMenuItem for the macro
*/
public MacroItem add(final Macro m, final String name) {
String s = name;
final int n = s.indexOf("/");
if (n < 0) {
MyMenuItem item;
if (FatherMenu == null)
item = null;
else {
item = new MyMenuItem(name);
// if (m.isProtected())
// item = new MyMenuItem("- " + name + " -");
// else
// item = new MyMenuItem(name);
FatherMenu.add(item);
}
final MacroItem mi = new MacroItem(m, item);
mi.Name = name;
V.addElement(mi);
return mi;
}
final String menu = s.substring(0, n);
s = s.substring(n + 1);
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof MacroMenu
&& ((MacroMenu) o).getName().equals(menu)) {
return ((MacroMenu) o).add(m, s);
}
}
MyMenu mm;
if (FatherMenu == null)
mm = null;
else {
mm = new MyMenu(menu);
FatherMenu.add(mm);
}
final MacroMenu macm = new MacroMenu(mm, menu, this);
V.addElement(macm);
return macm.add(m, s);
}
public boolean remove(final MacroItem item) {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof MacroMenu) {
final boolean res = ((MacroMenu) o).remove(item);
if (res) {
if (((MacroMenu) o).isEmpty()) {
V.removeElement(o);
if (FatherMenu != null)
FatherMenu.remove(((MacroMenu) o).FatherMenu);
}
return true;
}
} else {
if (((MacroItem) o).M == item.M) {
V.removeElement(o);
if (FatherMenu != null)
FatherMenu.remove(item.I);
return true;
}
}
}
return false;
}
public boolean replace(final MacroItem item, final MacroItem newitem) {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof MacroMenu) {
final boolean res = ((MacroMenu) o).replace(item, newitem);
if (res)
break;
} else {
if (((MacroItem) o).M == item.M) {
((MacroItem) o).M = newitem.M;
return true;
}
}
}
return false;
}
public String getName() {
return Name;
}
public boolean isEmpty() {
return V.size() == 0;
}
public Vector getV() {
return V;
}
public boolean hasSubmenus() {
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof MacroMenu)
return true;
}
return false;
}
public String getFullName() {
String s = Name;
MacroMenu m = this;
while (m.Father != null) {
m = m.Father;
s = m.Name + "/" + s;
}
return s;
}
public MacroMenu findWithFullName(String name) {
final int n = name.indexOf("/");
if (n < 0) {
if (name.equals(Name))
return this;
else
return null;
}
if (!name.substring(0, n).equals(Name))
return null;
name = name.substring(n + 1);
final Enumeration e = V.elements();
while (e.hasMoreElements()) {
final Object o = e.nextElement();
if (o instanceof MacroMenu) {
final MacroMenu m = (MacroMenu) o;
final MacroMenu res = m.findWithFullName(name);
if (res != null)
return res;
}
}
return null;
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

BIN
rene/zirkel/objects/.DS_Store vendored Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more