1 // KamiWaAi 0.0.4 beta Java application for interactive Euclidean geometry
2 // based on geometric algebra Cl(4,1) conformal model as implemented in
3 // the GeometricAlgebra Java package
4 // For current version of KamiWaAi application and GemoetricAlgebra package
5 // Go to ... http://sinai.mech.fukui-u.ac.jp/gcj/software/KamiWaAi/index.html
6 //
7 // Copyright (C) 2003, Eckhard M.S. Hitzer
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 // Go to ... http://www.gnu.org/copyleft/lesser.html
23 //
24 // hitzer@mech.fukui-u.ac.jp
25 //
26 // Department of Mechanical Engineering, Fukui University
27 // 3-9-1 Bunkyo, 910-8507 Fukui, Japan
28 //
29 //
30 //
31 // It the personal wish of E.M.S. Hitzer,
32 // that you never use this software for infringing human dignity:
33 //
34 // "God created man in his own image,
35 // in the image of God he created him;
36 // male and female he created them.
37 // [The Bible, Genesis chapter 1 verse 27]
38 //
39 //
40 //
41 // File KamiWaAi.java
42 // by Eckhard Hitzer
43 //
44 // Version 0.0.4 started: 2003-5-1
45 // Version 0.0.3 completed: 2003-4-10
46 //
47 //
48 // Next Step: T5 matching points to circles (or lines)
49 // ((or spheres))
50 // ideal would be to later be able to slide them on the circle (line, sphere)
51 // Concentrate first on matching points to circles!
52 //
53 // Todos: tasks T5-T7
54 //
55
56
57
58
59 package net.sourceforge.kamiwaai;
60 import java.awt.Color;
61 import java.awt.FlowLayout;
62 import java.awt.GridLayout;
63 import java.awt.event.WindowAdapter;
64 import java.awt.event.WindowEvent;
65 import java.util.HashMap;
66 import java.util.HashSet;
67 import java.util.LinkedList;
68
69 import javax.swing.ButtonGroup;
70 import javax.swing.JFrame;
71 import javax.swing.JPanel;
72 import javax.swing.JRadioButton;
73
74
75
76 public class KamiWaAi extends JFrame
77 {
78 KamiWaAiCanvas m_malflaeche; // Hier wird gezeichnet
79 KamiWaAiCanvas m_malflaecheZ;
80 //int pointsize = 10;
81 Color circlecolor = Color.red;
82 Color spherecolor = Color.yellow;
83 Color linecolor = new Color(176,176,255);
84 ButtonGroup ModeChoice; // aktueller Modus
85 // double m_Xpos, m_Ypos, m_Zpos; // aktuelle Mausposition
86 boolean sideview = false; // should not be moved
87 HashMap ENames = new HashMap();
88 LinkedList Clist = new LinkedList();
89 HashSet rdlist = new HashSet();
90 HashSet vdlist = new HashSet();
91
92 // Interger counters for creating the Hash keys of
93 // point, line, circle, sphere, ...
94 int pnum = 0;
95 int lnum = 0;
96 int cnum = 0;
97 int snum = 0;
98
99 String selectedPoint = " ";
100 String selectedLine = " ";
101 String selectedSphere = " ";
102 String selectedSphere1 = " ";
103 String selectedSphere2 = " ";
104 String mvdPoint = " ";
105 String LinePoints[] = new String[2];
106 String CirclePoints[] = new String[3];
107 String SpherePoints[] = new String[4];
108
109
110 // In main wird eine Instanz der Klasse angelegt
111 // und auf den Bildschirm gebracht
112 public static void main(String[] args)
113 {
114 KamiWaAi Fenster = new KamiWaAi("KamiWaAi 0.0.4 beta");
115 Fenster.pack();
116 Fenster.setSize(830,340);
117 Fenster.setResizable(false);
118 Fenster.show();
119 }
120
121 // Im Konstruktor werden eine Canvas-Malflaeche
122 // angelegt sowie eine ButtonGroup-Gruppe mit
123 // zur Auswahl stehenden Zeichenformen
124 private KamiWaAi(String titel)
125 {
126 super(titel);
127
128 // Einen Layout Manager anlegen
129 getContentPane().setLayout(new FlowLayout());
130
131 // Die Malflaeche anlegen
132 m_malflaeche = new CMeineCanvas(this);
133 getContentPane().add(m_malflaeche);
134 // Die MalflaecheZ anlegen
135 m_malflaecheZ = new CMeineCanvasZ(this);
136 getContentPane().add(m_malflaecheZ);
137
138
139 // Panel-Container für Schalter anlegen
140 JPanel panel = new JPanel();
141 // Gitter mit 4 Zeilen, 1 Spalte
142 panel.setLayout(new GridLayout(6,2,20,20));
143
144 // Optionsfelder zur Auswahl der Formen
145 ModeChoice = new ButtonGroup();
146
147 // 1. Optionsfelder erzeugen
148 JRadioButton opt1 =
149 new JRadioButton("point",true);
150 JRadioButton opt2 =
151 new JRadioButton("move",false);
152 JRadioButton opt3 =
153 new JRadioButton("circle",false);
154 JRadioButton opt4 =
155 new JRadioButton("sphere",false);
156 JRadioButton opt5 = // T1
157 new JRadioButton("sphere C,r",false);
158 JRadioButton opt6 = // T3
159 new JRadioButton("S int l",false);
160 JRadioButton opt7 = // T6
161 new JRadioButton("S int c",false);
162 JRadioButton opt8 = // T4
163 new JRadioButton("S int S",false);
164 JRadioButton opt9 = // T5
165 new JRadioButton("match",false);
166 JRadioButton opt10 = // T2
167 new JRadioButton("line",false);
168 JRadioButton opt11 = // T7
169 new JRadioButton("segment",false);
170
171 // 2. Befehlsnamen für Optionsfelder
172 opt1.setActionCommand("point" );
173 opt2.setActionCommand("move" );
174 opt3.setActionCommand("circle" );
175 opt4.setActionCommand("sphere" );
176 opt5.setActionCommand("sphere C,r");
177 opt6.setActionCommand("S int l" );
178 opt7.setActionCommand("S int c" );
179 opt8.setActionCommand("S int S" );
180 opt9.setActionCommand("match" );
181 opt10.setActionCommand("line" );
182 opt11.setActionCommand("segment" );
183
184 // 3. Optionsfelder in ButtonGroup-Gruppe
185 // aufnehmen
186 ModeChoice.add(opt1);
187 ModeChoice.add(opt2);
188 ModeChoice.add(opt3);
189 ModeChoice.add(opt4);
190 ModeChoice.add(opt5);
191 ModeChoice.add(opt6);
192 ModeChoice.add(opt7);
193 ModeChoice.add(opt8);
194 ModeChoice.add(opt9);
195 ModeChoice.add(opt10);
196 ModeChoice.add(opt11);
197
198 // 4. Optionsfelder in Panel aufnehmen
199 panel.add(opt1);
200 panel.add(opt4);
201 panel.add(opt10);
202 panel.add(opt2);
203 panel.add(opt3);
204 panel.add(opt6);
205 panel.add(opt5);
206 //panel.add(opt7);
207 panel.add(opt8);
208 //panel.add(opt9);
209 //panel.add(opt11);
210
211 getContentPane().add(panel);
212
213
214 class CMeinWindowAdapter extends WindowAdapter
215 {
216 public void windowClosing(WindowEvent e)
217 {
218 System.exit(0);
219 }
220 }
221
222 addWindowListener(new CMeinWindowAdapter());
223 } // End of CBasicDraw constructor
224
225
226
227
228
229
230 } // END
231