conrouter.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003-2004 by David Saxton                               *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef CONROUTER_H
00012 #define CONROUTER_H
00013 
00014 #include "cells.h"
00015 
00016 #include <qpoint.h>
00017 #include <qvaluelist.h>
00018 
00019 class ICNDocument;
00020 class Cell;
00021 
00022 typedef QValueList<QPoint> QPointList;
00023 typedef QValueList<QPointList> QPointListList;
00024 
00036 // TODO: ENHANCE THIS CODE!!!
00037 
00038 // needs to be easier to cut routes.
00039 // Routes need to be more intelligent/optimal.
00040 // needs to be able to improve the topology of the wires. 
00041 
00042 class ConRouter
00043 {
00044 public:
00045         ConRouter( ICNDocument *cv );
00046         ~ConRouter();
00047         
00051         void mapRoute( int sx, int sy, int ex, int ey );
00055         void translateRoute( int dx, int dy );
00060         void setPoints( const QPointList &pointList, bool reverse = false );
00064         void setRoutePoints( const QPointList &pointList );
00068         bool needsRouting( int sx, int sy, int ex, int ey ) const;
00072         QPointList pointList( bool reverse ) const;
00076         QPointList *cellPointList() { return &m_cellPointList; }
00082         QPointListList splitPoints( const QPoint &pos ) const;
00087         QPointListList dividePoints( uint n ) const;
00088 
00089 protected:
00093         bool checkLineRoute( int scx, int scy, int ecx, int ecy, int maxConScore, int maxCIScore );
00094         void checkACell( int x, int y, Cell *prev, int prevX, int prevY, int nextScore );
00095         void checkCell( int x, int y ); // Gets the shortest route from the final cell
00099         void removeDuplicatePoints();
00100         
00101         int xcells, ycells;
00102         int m_lcx, m_lcy; // Last x / y from mapRoute, if we need a point on the route
00103         Cells *cellsPtr;
00104         TempLabelMap tempLabels;
00105         ICNDocument *p_icnDocument;
00106         QPointList m_cellPointList;
00107 };
00108 
00109 #endif

Generated on Tue May 8 17:05:28 2007 for KTechLab by  doxygen 1.5.1