//This file is part of SECONDO. //Copyright (C) 2004, University in Hagen, Department of Computer Science, //Database Systems for New Applications. //SECONDO is free software; you can redistribute it and/or modify //it under the terms of the GNU General Public License as published by //the Free Software Foundation; either version 2 of the License, or //(at your option) any later version. //SECONDO 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 SECONDO; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package viewer.hoese.algebras; import java.awt.geom.*; import java.awt.*; import sj.lang.ListExpr; import java.util.*; import viewer.*; import viewer.hoese.*; import tools.Reporter; /** * A Displayclass for a path from the graph-algebra */ public class Dsplpath extends DisplayGraph { /** The internal datatype representation */ private Vector verticies; private Vector edges; private boolean defined; /** * Scans the numeric representation of a point datatype * * @param v * the nestedlist representation of the graph */ protected void ScanValue(ListExpr v) { int maxLabelLen=5; boolean romanNumbers=true; if(isUndefined(v)){ err = false; defined = false; return; } defined = true; verticies = new Vector(v.listLength()); float cost; edges = new Vector(v.listLength()); Dsplvertex tmpVertex; if(v.first().second().isAtom()) { Reporter.writeError("Error: It is not posible to view a path without goegraphical context!"); verticies=null; edges=null; err=true; return; } Dsplvertex lastVertex = new Dsplvertex((float) v.first().second() .first().realValue(), (float) v.first().second().second() .realValue(), v.first().first().intValue()); verticies.add(lastVertex); ListExpr rest = v.rest(); while (!rest.isEmpty()) { if(rest.second().second().isAtom()) { Reporter.writeError("Error: It is not posible to view a path without goegraphical context!"); verticies=null; edges=null; err=true; return; } cost = (float) rest.first().realValue(); tmpVertex = new Dsplvertex((float) rest.second().second().first() .realValue(), (float) rest.second().second().second() .realValue(), rest.second().first().intValue()); verticies.add(tmpVertex); if(tmpVertex.getLabelText(0.0).length()>maxLabelLen) romanNumbers=false; if(tmpVertex.getKey()<1)romanNumbers=false; if(tmpVertex.getKey()>3999)romanNumbers=false; edges.add(new Dspledge(lastVertex.getX(), lastVertex.getY(), tmpVertex.getX(), tmpVertex.getY(), cost)); lastVertex = tmpVertex; rest = rest.rest().rest(); } if (!romanNumbers) { Iterator it = verticies.iterator(); while (it.hasNext()) { ((Dsplvertex)it.next()).normLabel(); } } } public Shape getRenderObject(int i, AffineTransform af){ if(i