created mirror

This commit is contained in:
whatever
2026-09-14 20:19:29 -04:00
commit 6764738d92
600 changed files with 87187 additions and 0 deletions

191
Modules/mind/Mind.java Normal file
View File

@@ -0,0 +1,191 @@
/*
* Mind.java
*
* @author asko.soukka@iki.fi
* @version 0.1
*
* Copyright (c) 2002 Asko Soukka
* GZigZag is written by Tuomas Lukka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* See the LICENSE.lgpl for the specific terms of the license.
*
* This library 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
* Library General Public License for more details.
*/
/*
* Written by Asko Soukka and Tuukka Hastrup
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.util.*;
import java.io.*;
import java.awt.*;
/** Mindmap tools from Asko Soukka for mainly hierarcical structures
*/
public class Mind {
public static final String rcsid = "$Id: Mind.java,v 1.1.2.2 2002/02/16 15:46:58 tuukkah Exp $";
public static boolean dbg = false;
static final void p(String s) { if(dbg) ZZLogger.log(s); }
static final void pa(String s) { ZZLogger.log(s); }
static public ZZModule module = new ZZModule() {
public ZOb newZOb(String id) {
if(id.equals("Sundew"))
return new MindSundew();
else if(id.equals("Sun"))
return new MindSun();
return null;
}
public void action(String id, ZZCell code,
ZZCell target,
ZZView v, ZZView cv,
String key, Point pt,
ZZScene xi) {
try {
ZZCell viewCell = v.getViewcell();
ZZCell viewCursor = ZZCursorReal.get(viewCell);
if(id.equals("TextOut")) {
FileWriter fileout = new FileWriter(target.getText() + ".txt");
BufferedWriter writer = new BufferedWriter(fileout);
writer.write(target.getText()+"\n");
if (target.s("d.1", 1) != null) {
writer.write("\n");
printTextTree("d.2", "d.1", target.s("d.1", 1), writer,
1, 10);
writer.write("\n");
}
writer.close();
} else if(id.equals("HtmlOut")) {
FileWriter fileout = new FileWriter(target.getText()+".html");
BufferedWriter writer = new BufferedWriter(fileout);
writer.write("<html>\n");
writer.write("<head><title>\n");
writer.write(target.getText()+"\n");
writer.write("</title></head>\n");
writer.write("<body>\n");
writer.write("<h1>" + target.getText() + "</h1>\n");
if (target.s("d.1", 1) != null) {
writer.write("\n");
printHtmlTree("d.2", "d.1", "d.clone", target.s("d.1", 1),
writer, 1, 10, 2);
writer.write("\n");
}
writer.write("</body>\n");
writer.write("</html>\n");
writer.close();
} else {
pa("UNKNOWN Mind COMMAND "+id);
}
} catch(Exception e) {
e.printStackTrace();
throw new ZZError(""+e);
}
}
};
private static void printTextTree(String dim, String dimTop, ZZCell accursed,
BufferedWriter writer, int start, int end) {
Vector cells = getAllCells(dim, accursed);
int i = 0;
try {
while (i < cells.size()) {
if (!((ZZCell)cells.elementAt(i)).getText().equals("")) {
writer.write(/*"<li>"+*/((ZZCell)cells.elementAt(i)).getText()+"\n");
}
if (((ZZCell)cells.elementAt(i)).s(dimTop, 1) != null) {
for (int j=0; j<start; j++) writer.write("-"); writer.write("\n");
if(start < end) printTextTree(dim, dimTop, ((ZZCell)cells.elementAt(i)).s(dimTop, 1), writer,
start + 1, end);
writer.write("\n");
}
i++;
}
} catch (IOException iOE) {}
}
private static void printHtmlTree(String dim, String dimTop, String dimLink,
ZZCell accursed, BufferedWriter writer,
int start, int end, int topics) {
Vector cells = getAllCells(dim, accursed);
int i = 0;
try {
if (start > topics) writer.write("<ul>\n");
while (i < cells.size()) {
if (!((ZZCell)cells.elementAt(i)).getText().equals("")) {
if (start > topics) {
writer.write("<li>");
if (((ZZCell)cells.elementAt(i)).s(dimLink, -1) == null) {
if (((ZZCell)cells.elementAt(i)).s(dimLink, 1) != null)
writer.write("<a name=\""+((ZZCell)cells.elementAt(i)).getText()+"\"></a>");
writer.write(((ZZCell)cells.elementAt(i)).getText());
} else {
writer.write("<a href=\"#"+((ZZCell)cells.elementAt(i)).getText()+"\">");
writer.write(((ZZCell)cells.elementAt(i)).getText()+"</a>");
}
writer.write("\n");
} else {
writer.write("<h"+start+">");
if (((ZZCell)cells.elementAt(i)).s(dimLink, -1) == null) {
if (((ZZCell)cells.elementAt(i)).s(dimLink, 1) != null)
writer.write("<a name=\""+((ZZCell)cells.elementAt(i)).getText()+"\"></a>");
writer.write(((ZZCell)cells.elementAt(i)).getText());
} else {
writer.write("<a href=\"#"+((ZZCell)cells.elementAt(i)).getText()+"\">");
writer.write(((ZZCell)cells.elementAt(i)).getText()+"</a>");
}
writer.write("</h"+start+">\n");
}
}
if (((ZZCell)cells.elementAt(i)).s(dimTop, 1) != null) {
writer.write("\n");
if(start < end) printHtmlTree(dim, dimTop, dimLink, ((ZZCell)cells.elementAt(i)).s(dimTop, 1), writer,
start + 1, end, topics);
writer.write("\n");
}
i++;
}
if (start > topics) writer.write("</ul>\n");
} catch (IOException iOE) {}
}
private static Vector getAllCells(String dim, ZZCell accursed) {
int LIMIT = 1000;
Vector cells = new Vector();
ZZCell next = null;
cells.addElement(accursed);
int i = 1;
while (cells.size() < LIMIT ) {
next = accursed.s(dim, i++);
if(next != null && !cells.contains(next)) cells.addElement(next);
else break;
}
return cells;
}
}

398
Modules/mind/MindSun.java Normal file
View File

@@ -0,0 +1,398 @@
/*
* MindSun.java
*
* A View for GZZ 0.6.X.
*
* @author asko.soukka@iki.fi
* @version 0.1
*
* I was not satisfied with MindSundiew view. It wasted too much space
* and still did not show enough information. So, I dropped using full circles.
* Still this view is optimized for cyclic structures.
*
* Copyright (c) 2002 Asko Soukka
* Contains a few parts of CompassView.java (c) 2002 Tuukka Hastrup
* GZigZag is written by Tuomas Lukka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* See the LICENSE.lgpl for the specific terms of the license.
*
* This library 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
* Library General Public License for more details.
*/
/*
To do:
Commenting code :) (javadoc-spesific)
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.lang.Math;
import java.util.Vector;
class MindSun implements FlobView, ZOb {
/** */
public static final String rcsid = "$Id: MindSun.java,v 1.1.2.3 2002/02/16 16:33:06 tuukkah Exp $";
public MindSun() {}
/**
* @param
*/
public String readParams(ZZCell c) { return null; };
/**
* @param
* @param
* @param
* @param
* @param
*/
public void raster(FlobSet into, FlobFactory fact, ZZCell view,
String[] dims, ZZCell accursed) {
/** */
Dimension d = into.getSize();
int midx = d.width / 2;
int midy = d.height / 2;
int r = d.width / 5;
/** */
ZZUtil.showFlobDims(into, fact, view, 3);
/** */
Vector cells = getAllCells(dims[1], accursed);
if (cells.size() > 0) {
drawCircle(midx, midy, into, fact, dims[1], cells, r, 1, false);
drawTopCurves(midx, midy, into, fact, dims, cells, r, 1.95 * Math.PI, 2, 4, true);
drawSubCurves(midx, midy, into, fact, dims, cells, r, 0.95 * Math.PI, 2.95 * Math.PI, 2, 3, true);
/** */
Dimension c = fact.getSize(null, 1);
int cw = c.width;
int ch = c.height;
for (int i = 1; i < 4; i++) {
if (accursed.s(dims[2], -i) != null) {
fact.makeFlob(into, accursed.s(dims[2], -i), accursed.s(dims[2], -i),
(float)0.75, midx + x(1.95 * Math.PI, r)-cw/2, midy+y(1.95 * Math.PI, r)-ch/2*(i+1), i+1,
(int)(cw * 0.75), (int)(ch * 0.75));
}
if (accursed.s(dims[2], i) != null) {
fact.makeFlob(into, accursed.s(dims[2], i), accursed.s(dims[2], i),
(float)0.75, midx + x(1.95 * Math.PI, r)-cw/2, midy+y(1.95 * Math.PI, r)-ch/3+ch/2*i, i+1,
(int)(cw * 0.75), (int)(ch * 0.75));
}
}
}
}
/**
* @param
* @param
*/
private Vector getAllCells(String dim, ZZCell accursed) {
/** */
int LIMIT = 20;
/** */
Vector cells = new Vector();
/** */
ZZCell next = null;
/** */
cells.addElement(accursed);
/** */
int i = 1;
do {
if (cells.size() > LIMIT / 2) break;
next = accursed.s(dim, i++);
if(next != null && !cells.contains(next)) cells.addElement(next);
else break;
} while (true);
/** */
i = -1;
do {
if (i < -LIMIT / 2) break;
next = accursed.s(dim, i--);
} while (next != null && !cells.contains(next));
/** */
if (next != accursed) {
i += 2;
do {
if (cells.size() > LIMIT) break;
next = accursed.s(dim, i++);
if(next != null && !cells.contains(next)) cells.addElement(next);
else break;
} while (true);
}
/** */
return cells;
}
/**
* @param
* @param
* @param
* @param
* @param
* @param
* @param
* @param
*/
private void drawTopCurves(int midx, int midy, FlobSet into, FlobFactory fact, String[] dims, Vector cells,
int r, double angle, int startLevel, int endLevel, boolean vanishing) {
/** */
float factor = (float) (-Math.log(startLevel) / (-Math.log(startLevel)+2.7) + 1);
/** */
double angleStep = 2 * Math.PI / cells.size();
/** */
for (int i=0; i<cells.size(); i++) {
if (((ZZCell)cells.elementAt(i)).s(dims[0], -1) != null) {
Vector subCells = getAllCells(dims[1], ((ZZCell)cells.elementAt(i)).s(dims[0], -1));
drawCurve(midx, midy, into, fact, subCells, angle - angleStep / 2, angle + angleStep / 2,
(int)(r * factor), startLevel, true);
/** */
if (startLevel < endLevel)
drawTopCurves(midx, midy, into, fact, dims, subCells, r, angle,
startLevel + 1, endLevel, true);
}
/** */
angle += angleStep;
}
}
/**
* @param
* @param
* @param
* @param
* @param
* @param
* @param
* @param
*/
private void drawSubCurves(int midx, int midy, FlobSet into, FlobFactory fact, String[] dims, Vector cells,
int r, double startAngle, double endAngle, int startLevel, int endLevel, boolean vanishing) {
/** */
float factor = (float)Math.log(startLevel)+1;
/** */
double angle = startAngle + (endAngle - startAngle) / 2;
ZZCell backup = null;
/** */
if (cells.elementAt(0) != null && ((ZZCell)cells.elementAt(0)).getText().equals("") && startLevel != 2) {
backup = (ZZCell)cells.elementAt(0);
cells.removeElementAt(0);
}
/** */
double angleStep;
if (cells.size()%2 == 0 && startLevel != 2) angleStep = (endAngle - startAngle) / (cells.size() + 1);
else angleStep = (endAngle - startAngle) / cells.size();
/** */
for (int i=0; i<cells.size(); i++) {
if (((ZZCell)cells.elementAt(i)).s(dims[0], 1) != null) {
Vector subCells = getAllCells(dims[1], ((ZZCell)cells.elementAt(i)).s(dims[0], 1));
drawCurve(midx, midy, into, fact, subCells, angle - angleStep/2 + 0.05 * (1/factor),
angle + angleStep/2 - 0.05 * (1/factor), (int)(r * factor), startLevel, true);
/** */
if (startLevel < endLevel)
drawSubCurves(midx, midy, into, fact, dims, subCells, r,
angle - angleStep/2, angle + angleStep/2,
startLevel+1, endLevel, true);
}
/** */
angle += angleStep;
if (cells.size()%2 == 0 && angle >= endAngle - angleStep / 3 * 2
|| cells.size()%2 != 0 && angle >= endAngle)
angle = (startAngle + (endAngle - startAngle) / 2) - (cells.size() - (i + 1)) * angleStep;
}
/** */
if (backup != null) cells.insertElementAt(backup, 0);
}
/**
* @param
* @param
* @param
* @param
* @param
* @param
* @param
* @param
*/
private void drawCurve(int midx, int midy, FlobSet into, FlobFactory fact, Vector cells,
double startAngle, double endAngle, int r, int level, boolean vanishing) {
/** */
Dimension c = fact.getSize(null, 1);
int cw = c.width;
int ch = c.height;
/** */
double angle = startAngle + (endAngle - startAngle) / 2;
/** */
int i = 0;
ZZCell backup = null;
/** */
if (cells.elementAt(0) != null && ((ZZCell)cells.elementAt(0)).getText().equals("")) {
int dx = x(angle, r-cw/8);
int dy = y(angle, r-cw/8);
float factor = (float)-Math.log(level)/4+1;
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
factor, midx + dx-cw/2, midy+dy-ch/2, level+2, (int)(cw * factor), (int)(ch * factor));
backup = (ZZCell)cells.elementAt(0);
cells.removeElementAt(0);
}
/** */
double angleStep;
if (cells.size()%2 == 0) angleStep = (endAngle - startAngle) / (cells.size() + 1);
else angleStep = (endAngle - startAngle) / cells.size();
/** */
while (i < cells.size()) {
int dx = x(angle, r);
int dy = y(angle, r);
/** */
float factor;
if (i == 0) factor = (float)(-Math.log(level)/4+1.1);
else factor = (float)-Math.log(level)/4+1;
if(cells.elementAt(i) != null)
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
factor, midx + dx-cw/2, midy+dy-ch/2, level, (int)(cw * factor), (int)(ch * factor));
/** */
if (vanishing) {
if (i < cells.size() / 2) level ++;
else if (i > cells.size() / 2) level --;
}
i++;
/** */
angle += angleStep;
if (cells.size()%2 == 0 && angle >= endAngle - angleStep / 3 * 2
|| cells.size()%2 != 0 && angle >= endAngle)
angle = (startAngle + (endAngle - startAngle) / 2) - (cells.size() - i) * angleStep;
}
/** */
if (backup != null) cells.insertElementAt(backup, 0);
}
/**
* @param
* @param
* @param
* @param
* @param
* @param
* @param
* @param
*/
private void drawCircle(int midx, int midy, FlobSet into, FlobFactory fact, String dim, Vector cells,
int r, int level, boolean vanishing) {
/** */
LineDecor.Builder line = new LineDecor.Builder(into, Color.red);
line.startl(4, 1);
/** */
Dimension c = fact.getSize(null, 1);
int cw = c.width;
int ch = c.height;
/** */
double angleStep = 2 * Math.PI / cells.size();
double angle = (double) 1.95 * Math.PI;
/** */
int i = 0;
while (i < cells.size()) {
int dx = x(angle, r);
int dy = y(angle, r);
/** */
float factor = (float)-Math.log(level)/4+1;
if(cells.elementAt(i) != null)
/* fact.centerFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
factor, new Point(midx + dx-cw/2, midy+dy-ch/2), 0, 0, level);*/
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
factor, midx + dx-cw/2, midy+dy-ch/2, level, (int)(cw * factor), (int)(ch * factor));
/** */
if (vanishing) {
if (i < cells.size() / 2) level ++;
else if (i > cells.size() / 2) level --;
}
/** */
angle += angleStep;
/** */
if (cells.elementAt(i)!=null && cells.size() > 1) {
if (((ZZCell)cells.elementAt(i)).s(dim, 1) == null) {
line.l(midx+x(angle - angleStep / 2 - 0.01, r-ch)-cw/2, midy+y(angle - angleStep / 2 - 0.01, r-ch)-ch/2,
midx+x(angle - angleStep / 2 - 0.01, r+ch)-cw/2, midy+y(angle - angleStep / 2 - 0.01, r+ch)-ch/2);
line.l(midx+x(angle - angleStep / 2 + 0.01, r-ch)-cw/2, midy+y(angle - angleStep / 2 + 0.01, r-ch)-ch/2,
midx+x(angle - angleStep / 2 + 0.01, r+ch)-cw/2, midy+y(angle - angleStep / 2 + 0.01, r+ch)-ch/2);
}
else if (i < cells.size() - 1) {
if (((ZZCell)cells.elementAt(i)).s(dim, 1) != (ZZCell)cells.elementAt(i+1))
line.l(midx+x(angle - angleStep / 2, r-ch)-cw/2, midy+y(angle - angleStep / 2, r-ch)-ch/2,
midx+x(angle - angleStep / 2, r+ch)-cw/2, midy+y(angle - angleStep / 2, r+ch)-ch/2);
} else {
if (((ZZCell)cells.elementAt(i)).s(dim, 1) != (ZZCell)cells.elementAt(0)) {
line.l(midx+x(angle - angleStep / 2, r-ch)-cw/2, midy+y(angle - angleStep / 2, r-ch)-ch/2,
midx+x(angle - angleStep / 2, r+ch)-cw/2, midy+y(angle - angleStep / 2, r+ch)-ch/2);
line.l(midx+x(angle - angleStep / 2 + 0.01, r-ch)-cw/2, midy+y(angle - angleStep / 2 + 0.01, r-ch)-ch/2,
midx+x(angle - angleStep / 2 + 0.01, r+ch)-cw/2, midy+y(angle - angleStep / 2 + 0.01, r+ch)-ch/2);
}
}
}
/** */
i++;
}
/** */
line.endl();
}
protected int x(double angle, int length) {
return (int)(Math.cos(angle) * length);
}
protected int y(double angle, int length) {
return (int)(Math.sin(angle) * length);
}
}

View File

@@ -0,0 +1,247 @@
/*
* MindSundew.java
*
* Ajatuskihokkipurkkaviritys GZZ 0.6.X:lle.
* Mindmap scribble for GZigZag 0.6.X.
*
* @author asko.soukka@iki.fi
*
* Copyright (C) 2001 Asko Soukka, based on CompassView.java by Tuukka Hastrup
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* See the LICENSE.lgpl for the specific terms of the license.
*
* This library 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
* Library General Public License for more details.
*/
package org.gzigzag.module;
import org.gzigzag.*;
import java.awt.Dimension;
import java.lang.Math;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.util.Vector;
class MindSundew implements FlobView, ZOb {
public static final String rcsid = "$Id: MindSundew.java,v 1.1.2.1 2002/02/16 15:19:25 tuukkah Exp $";
private int level = 0;
private int levelA = 0;
private int levelB = 0;
public MindSundew() {}
public String readParams(ZZCell c) { return null; };
public void raster(FlobSet into, FlobFactory fact, ZZCell view,
String[] dims, ZZCell accursed) {
/* ---- alustetaan kaikenlaista ---- */
// FlobDecorator linker = new StdLinks();
ZZCell stdim = ZZCursorReal.get(view.s("d.dims", 1));
Dimension d = into.getSize();
int midx = d.width / 2;
int midy = d.height / 2;
Dimension c = fact.getSize(null, 1);
int cw = c.width;
int ch = c.height;
ZZUtil.showFlobDims(into, fact, view, 3);
/* ---------------------------------------------------- */
/* ---- piirretään ulottuvuuksien värit ylänurkkaan ---- */
LineDecor.Builder line1 = new LineDecor.Builder(into, Color.black);
LineDecor.Builder line2 = new LineDecor.Builder(into, Color.gray);
LineDecor.Builder line3 = new LineDecor.Builder(into, Color.yellow);
line1.startl(4, 1);
line2.startl(4, 1);
line3.startl(4, 1);
line1.l(c.width/2, c.height/2, c.width*2, c.height/2);
line2.l(c.width/2, c.height/2, c.width/2, c.height*2);
line3.l(c.width/2, c.height/2, c.width*2, c.height*2);
line1.endl();
line2.endl();
line3.endl();
/* ---------------------------------------------------- */
/* ---- kutsutaan ensimmäistä piirtokierrosta ---- */
drawLevel(into, fact, dims, accursed, d, c, stdim, midx, midy, cw, ch);
//linker.decorate(into, "", view);
/* ---------------------------------------------------- */
}
private void drawLevel(FlobSet into, FlobFactory fact, String[] dims, ZZCell accursed,
Dimension d, Dimension c, ZZCell stdim, int midx, int midy, int cw, int ch) {
/* ---- asetetaan piirtokierroksen tasokohtaiset ---- */
level++;
float kerroin = 1; // käytetään solujen piirtokoossa
if (level > 1) {
kerroin = (float)0.7;
for (int i=2; i<level; i++)
kerroin = kerroin * kerroin;
}
/* ---------------------------------------------------- */
/* ---- alustetaan piirtokierroksen jutut ---- */
Vector cells = new Vector(); // Cells to positive directions to be drawn
ZZCell dim, tc, top;
top = null;
dim = stdim;
/* ---------------------------------------------------- */
/* ---- haetaan kierroksella piirrettävät solut ---- */
cells.addElement(accursed);
top = accursed.s(dims[0], -1);
int i = 1;
do {
tc = accursed.s(dims[1], i++);
if(tc != null && tc != accursed) {
cells.addElement(tc);
if (top == null) top = tc.s(dims[0], -1);
}
else break;
} while (true);
i = -1;
do { tc = accursed.s(dims[1], i--); } while (tc != null && tc != accursed);
if (tc == null) {
i += 2;
do {
tc = accursed.s(dims[1], i++);
if(tc != null && tc != accursed) {
cells.addElement(tc);
if (top == null) top = tc.s(dims[0], -1);
}
else break;
} while (true);
}
if(cells.size() == 0) return; // No cells to draw
/* ---------------------------------------------------- */
/* ---- ympyrän laskemiseen tarvittavia juttuja ---- */
double angle = 2 * Math.PI / (cells.size());
int l = (int) ((d.height < d.width ? d.height : d.width)
/ 2 * 0.47 * kerroin * kerroin ); // syvyystasojen etäisyys ja säde
double a = (double) 1.95 * Math.PI; // Begin placing positive cells top left
/* ---------------------------------------------------- */
/* ---- viivapiirtureiden alustus ---- */
LineDecor.Builder line1 = new LineDecor.Builder(into, Color.black);
LineDecor.Builder line2 = new LineDecor.Builder(into, Color.gray);
LineDecor.Builder line3 = new LineDecor.Builder(into, Color.yellow);
line1.startl(cells.size()*4, 12);
line2.startl(cells.size()*4, 12);
line3.startl(cells.size()*4, 12);
/* ---------------------------------------------------- */
/* ---- solujen piirto ja uusien kierrosten käynnistys- */
i = 0;
while (i < cells.size()) {
int dx = x(a, l);
int dy = y(a, l);
if(cells.elementAt(i)!=null) {
/* // ensimmäinen yläkäsite piirretään isolla, muuta tasokohtaisesti
if (levelA == 1 && (ZZCell)cells.elementAt(i) == accursed)
fact.centerFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
(float)1.1, new java.awt.Point(midx + dx-cw/2, midy+dy-ch/2), 0, 0, 1);
else if (levelB != 1)
fact.centerFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
kerroin, new java.awt.Point(midx + dx-cw/2, midy+dy-ch/2), 0, 0, level * level);
else
fact.centerFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
kerroin, new java.awt.Point(midx + dx-cw/2, midy+dy-ch/2), 0, 0, level); */
// ensimmäinen yläkäsite piirretään isolla, muuta tasokohtaisesti
if (levelA == 1 && (ZZCell)cells.elementAt(i) == accursed)
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
(float)1.1, midx + dx-cw/2, midy+dy-ch/2, 1, cw, ch);
else if (levelB != 1)
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
kerroin, midx + dx-cw/2, midy+dy-ch/2, level*level, (int)(cw * kerroin), (int)(ch * kerroin));
else
fact.makeFlob(into, (ZZCell)cells.elementAt(i), (ZZCell)cells.elementAt(i),
kerroin, midx + dx-cw/2, midy+dy-ch/2, level, (int)(cw * kerroin), (int)(ch * kerroin));
// jos ei olla piirtämässä alakäsitteitä, käynnistetään piirto löydetylle yläkäsitteelle
if (((ZZCell)cells.elementAt(i)).s(dims[0], -1) == top
&& level < 3 && top != null && levelB == 0) {
levelA++;
line1.l(midx + dx-cw/2, midy+dy-ch/2, midx-cw/2, midy-ch/2);
drawLevel(into, fact, dims, top, d, c, stdim, midx, midy, cw, ch);
levelA--;
}
// jos ei olla piirtämässä yläkäsitteitä, käynnistetään piirto löydetylle alakäsitteelle
if (((ZZCell)cells.elementAt(i)).s(dims[0], 1) != null && level < 3 && levelA == 0) {
levelB++;
line1.l(midx + dx-cw/2, midy+dy-ch/2, (int)(midx + (dx)*(1/kerroin)*2/level-cw/2),
(int)(midy + (dy)*(1/kerroin)*2/level-ch/2));
if (level < 2)
drawLevel(into, fact, dims, ((ZZCell)cells.elementAt(i)).s(dims[0], 1), d, c, stdim,
(int)(midx + (dx)*(1/kerroin)*2/level), (int)(midy + (dy)*(1/kerroin)*2/level), cw, ch);
levelB--;
}
// käynnistetään piirto löydetylle sivuttaislinkitykselle
if ((ZZCell)cells.elementAt(i) == accursed &&
((ZZCell)cells.elementAt(i)).s(dims[2], -1) != null && level == 1) {
line3.l(midx + dx-cw/2, midy+dy-ch/2, (int)(d.width / 10)+cw+cw/8, (int)(d.height / 10));
// line3.l(midx + dx-cw/2, midy+dy-ch/2, (int)(d.width / 10)+cw/2, (int)(d.height / 10)+ch/2);
drawLevel(into, fact, dims, ((ZZCell)cells.elementAt(i)).s(dims[2], -1), d, c, stdim,
(int)(d.width / 10)+cw, (int)(d.height / 10)+ch, cw, ch);
}
if ((ZZCell)cells.elementAt(i) == accursed &&
((ZZCell)cells.elementAt(i)).s(dims[2], 1) != null && level == 1) {
line3.l(midx + dx-cw/2, midy+dy-ch/2, (int)(d.width * 9/10)+cw/4,
(int)(d.height * 9/10));
// line3.l(midx + dx-cw/2, midy+dy-ch/2, (int)(d.width * 9/10)-cw/2,
// (int)(d.height * 9/10)-ch/2);
drawLevel(into, fact, dims, ((ZZCell)cells.elementAt(i)).s(dims[2], 1), d, c, stdim,
(int)(d.width * 9/10), (int)(d.height * 9/10), cw, ch);
}
}
// siirrytään ympyrän kehällä eteenpäni
a += angle; // Rotate clockwise
// jos solusta on jatke eteenpäin (täytynee olla kehällä), piirretään viiva
if (cells.elementAt(i)!=null && levelB < 2)
if (((ZZCell)cells.elementAt(i)).s(dims[1], 1) != null)
line2.l(midx + dx-cw/2, midy+dy-ch/2, midx + x(a, l)-cw/2, midy+y(a, l)-ch/2);
// seuraava solu jonossa
i++;
}
/* ---------------------------------------------------- */
/* ---- piirtureiden lopetus ja tason lasku ----- */
line1.endl();
line2.endl();
line3.endl();
level--;
/* ---------------------------------------------------- */
}
protected int x(double angle, int length) {
return (int)(Math.cos(angle) * length);
}
protected int y(double angle, int length) {
return (int)(Math.sin(angle) * length);
}
}