31#include <QPainterPath>
55 this->setVisible(
bool(s));
56 if (this->nameLabel !=
nullptr)
58 this->nameLabel->setVisible(
bool(s));
71 connect(
this, SIGNAL(valueChanged(
double)),
this, SLOT(
setValue(
double)));
79 void setValue(
double Value,
bool BlockSignals =
false)
89 this->setVisible(
bool(s));
105 connect(
this, SIGNAL(stateChanged(
int)),
this, SLOT(
findSignal(
int)));
123 this->setVisible(!
bool(s));
132 if (s ==1 && this->checkState()== Qt::CheckState::Unchecked)
134 setCheckState(Qt::CheckState::Checked);
135 emit stateChanged(1);
140 if (s == 0 && this->checkState() == Qt::CheckState::Checked)
142 setCheckState(Qt::CheckState::Unchecked);
143 emit stateChanged(0);
186 if (this->x == s.
x && this->y == s.
y)
195 a.
x = this->x -= s.
x;
196 a.
y = this->y -= s.
y;
202 a.
x = this->x += s.
x;
203 a.
y = this->y += s.
y;
212 void set(
double a,
double b)
324 case 0:
NminX = value;
328 case 2:
NmaxX = value;
330 case 3:
NmaxY = value;
348 void copyFromField(std::vector<Canvas::Coord2D> coord01, std::vector<MyCoord>& thisArray)
352 for (
auto it : coord01)
360 void copyFromField(std::vector<Canvas::OriginalCoord> coord01, std::vector<MyCoord>& thisArray)
364 for (
auto it : coord01)
368 thisArray.push_back(s);
397 void reSort(std::vector<MyCoord>& vector1)
403 std::sort(vector1.begin(), vector1.end(),
sortx);
408 sort(vector1.begin(), vector1.end(),
sorty);
416 s.
x = int(value.
x *
float(x1 - x0)) + x0;
417 s.
y = int((1 - value.
y) *
float(y1 - y0)) + y0;
563 int totalLength =
mPath.length();
566 for (
size_t i = 0; i < 500; i++)
572 if (length <= totalLength)
574 perc =
mPath.percentAtLength(qreal(length));
582 QP =
mPath.pointAtPercent(perc);
594 QPainterPath tempPath;
606 int idf = itf->second;
616 float tempLength = tempPath.length();
638 int searchRadius = 10;
640 if (
isSquard) { searchRadius = 20; }
641 else { searchRadius = 10; }
643 if (dis < searchRadius)
646 float finalLength = -1;
649 if (realLength <= it.first)
651 finalLength = it.first;
655 if (finalLength == -1)
684 if (a.
x < b.
x) {
return true; }
685 else {
return false; }
689 if (a.
y < b.
y) {
return true; }
690 else {
return false; }
715 QWidget::keyPressEvent(event);
716 parent()->event((QEvent*)event);
717 if (event->key() == Qt::Key_Alt)
722 if (event->key() == Qt::Key_Control)
727 if (event->key() == Qt::Key_Shift)
796 double x = double(coord.
x);
797 double y = double(coord.
y);
798 double fmaxX = double(
maxX);
799 double fminX = double(
minX);
800 double fmaxY = double(
maxY);
801 double fminY = double(
minY);
803 s.
x = (
x - fminX) / (fmaxX - fminX);
804 s.
y = 1 - (
y - fminY) / (fmaxY - fminY);
813 this->releaseKeyboard();
818 double fmaxX = double(
maxX);
819 double fminX = double(
minX);
820 double fmaxY = double(
maxY);
821 double fminY = double(
minY);
822 for (
size_t i = 0; i <
Array.size(); i++)
824 int newMaxY =
h - 1.5 * double(
radius);
825 float k = (double(
Array[i].
y) - fminY) / (fmaxY - fminY);
826 Array[i].y = k * (newMaxY - fminY) + fminY;
832 myfloatCoord.clear();
833 for (
auto it : CoordArray)
841 QWidget::keyPressEvent(event);
842 parent()->event((QEvent*)event);
843 if (event->key() == Qt::Key_Alt)
848 if (event->key() == Qt::Key_Control)
854 if (event->key() == Qt::Key_Shift)
This class is designed to be elegant, so it can be directly passed to GPU as parameters.
QDoubleSlider(QWidget *pParent=NULL)
void setValue(double Value, bool BlockSignals=false)
QDoubleSpinner(QWidget *pParent=NULL)
bool mInsertBezierOpenPoint
int insertCurvePoint(MyCoord pCoord)
virtual void updateDataToField()
void keyReleaseEvent(QKeyEvent *event)
std::vector< MyCoord > mCoordArray
static bool sortx(MyCoord a, MyCoord b)
void buildHandlePointSet()
void updateFloatCoordArray(std::vector< MyCoord > CoordArray, std::vector< Coord0_1 > &myfloatCoord)
void reSort(std::vector< MyCoord > &vector1)
void leaveEvent(QEvent *event)
void initializeLine(Dir mode)
Coord0_1 CoordTo0_1Value(MyCoord &coord)
void buildCoordToResortMap()
void copyFromField(std::vector< Canvas::OriginalCoord > coord01, std::vector< MyCoord > &thisArray)
std::map< int, int > mMapResortIDtoOriginalID
std::vector< Coord0_1 > mFloatCoord
std::vector< Coord0_1 > mHandleFloatCoord
std::vector< MyCoord > mReSortCoordArray
void setLinearResample(int s)
virtual int addPointtoEnd()
std::vector< MyCoord > mHandlePoints
std::vector< MyCoord > mCurvePoint
void mouseReleaseEvent(QMouseEvent *event)
void setSpacingToDrawLabel(double value, int id)
void setLabelSize(int minX, int minY, int maxX, int maxY)
void insertHandlePoint(int fp, MyCoord pCoord)
std::map< int, float > mCurvePointMapLength
void insertElementToHandlePointSet(int i)
static bool sorty(MyCoord a, MyCoord b)
void SetValueToDrawLabel(double value, int id)
void keyPressEvent(QKeyEvent *event)
std::vector< int > mMultiSelectID
void remapArrayToHeight(std::vector< MyCoord > &Array, int h)
void copyFromField(std::vector< Canvas::Coord2D > coord01, std::vector< MyCoord > &thisArray)
std::map< float, EndPoint > mLengthMapEndPoint
MyCoord ZeroOneToCoord(Coord0_1 &value, int x0, int x1, int y0, int y1)
std::map< int, int > mMapOriginalIDtoResortID
mQCheckBox(QWidget *pParent=NULL)
void updateChecked(int s)
void setNewVisable(int s)
void updateUnchecked(int s)
mQDoubleSlider(QWidget *pParent=NULL)
void setNewVisable(int s)
void setValue(double Value, bool BlockSignals=false)
void setNewVisable(int s)
mQDoubleSpinner(QWidget *pParent=NULL)
void valueChangedAndID(double Value, int i)
This is an implementation of AdditiveCCD based on peridyno.
DYN_FUNC Complex< Real > sqrt(const Complex< Real > &)
void set(double a, double b)
MyCoord operator+(MyCoord s)
MyCoord operator-(MyCoord s)
bool operator==(MyCoord s)