1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// hdPolyLineLocator.cpp - Return multiple location at same time for a PolyLine
//
//////////////////////////////////////////////////////////////////////////
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
// App headers
#include "hotdraw/locators/hdPolyLineLocator.h"
#include "hotdraw/figures/hdIFigure.h"
#include "hotdraw/utilities/hdRect.h"
#include "hotdraw/figures/hdPolyLineFigure.h"
hdPolyLineLocator::~hdPolyLineLocator()
{
}
//This index refers to point index inside collection not the diagram index
hdPolyLineLocator::hdPolyLineLocator(int index)
{
indx = index;
}
hdPoint &hdPolyLineLocator::locate(int posIdx, hdIFigure *owner)
{
hdPolyLineFigure *figure = (hdPolyLineFigure *) owner;
//A Handle at polyline figure without a respetive flexibility point at line
//Hack to allow handles of polylines reuse between different versions of same line.
if(figure && indx >= (figure->countPointsAt(posIdx) - 1) ) //indx 0 is first, count first is 1
{
locatePoint.x = -100; //Any negative number that don't allow to the mouse to reach this locator
locatePoint.y = -100;
return locatePoint;
}
else if(figure)
{
locatePoint = figure->pointAt(posIdx, indx);
return locatePoint;
}
else
{
return locatePoint;
}
}
void hdPolyLineLocator::setIndex(int index)
{
indx = index;
}
|