vertices.cpp revision 6b15695578f07a3f72c4c9475c1a261a3021472a
/*
* vim: ts=4 sw=4 et tw=0 wm=0
*
* libavoid - Fast, Incremental, Object-avoiding Line Router
* Copyright (C) 2004-2005 Michael Wybrow <mjwybrow@users.sourceforge.net>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "libavoid/geometry.h"
namespace Avoid {
{
}
, isShape(s)
, vn(n)
{
}
{
}
{
// Gracefully handle self assignment
//if (this == &rhs) return *this;
return *this;
}
{
{
return false;
}
return true;
}
{
{
return true;
}
return false;
}
{
{
return true;
}
return false;
}
{
}
{
}
{
vn += 1;
return *this;
}
{
}
{
}
, visListSize(0)
, invisListSize(0)
, pathDist(0)
{
}
{
}
{
if (isConnVert)
{
}
// For each vertex.
{
// Remove each visibility edge
(*edge)->alertConns();
delete (*edge);
}
{
// Remove each invisibility edge
delete (*edge);
}
}
{
{
}
{
}
// The "beginning" should be the first shape vertex, rather
// than an endpoint, which are also stored in "vertices".
{
{
{
return false;
}
}
}
return true;
}
, _shapeVertices(0)
, _connVertices(0)
{
}
#define checkVertInfListConditions() \
do { \
(_firstConnVert && _lastConnVert) ); \
(_firstShapeVert && _lastShapeVert) ); \
} while(0)
{
{
// A Connector vertex
if (_firstConnVert)
{
// Join with previous front
// Make front
}
else
{
// Make front and back
// Link to front of shapes list
}
}
else // if (vert->id.shape > 0)
{
// A Shape vertex
if (_lastShapeVert)
{
// Join with previous back
// Make back
}
else
{
// Make first and last
// Join with conns list
if (_lastConnVert)
{
}
}
}
}
{
// Conditions for correct data structure
{
// A Connector vertex
if (vert == _firstConnVert)
{
if (vert == _lastConnVert)
{
}
else
{
// Set new first
if (_firstConnVert)
{
// Set previous
}
}
}
else if (vert == _lastConnVert)
{
// Set new last
// Make last point to shapes list
}
else
{
}
}
else // if (vert->id.shape > 0)
{
// A Shape vertex
if (vert == _lastShapeVert)
{
// Set new last
if (vert == _firstShapeVert)
{
if (_lastConnVert)
{
}
}
if (_lastShapeVert)
{
}
}
else if (vert == _firstShapeVert)
{
// Set new first
// Correct the last conn vertex
if (_lastConnVert)
{
}
if (_firstShapeVert)
{
}
}
else
{
}
}
}
{
return _firstShapeVert;
}
{
if (_firstConnVert)
{
return _firstConnVert;
}
// No connector vertices
return _firstShapeVert;
}
{
return NULL;
}
}