Resolved issue #232. New tool: intersection of arcs.
--HG-- branch : develop
This commit is contained in:
commit
d1b2613a61
|
@ -384,6 +384,10 @@ QString DialogHistory::Record(const VToolRecord &tool)
|
|||
.arg(PointName(tool.getId()))
|
||||
.arg(PointName(AttrUInt(domElem, VAbstractTool::AttrBasePoint)));
|
||||
}
|
||||
case Tool::PointOfIntersectionArcs:
|
||||
{
|
||||
return QString(tr("%1 - point of arcs intersection")).arg(PointName(tool.getId()));
|
||||
}
|
||||
//Because "history" not only show history of pattern, but help restore current data for each pattern's
|
||||
//piece, we need add record about details and nodes, but don't show them.
|
||||
case Tool::Detail:
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "tools/dialogpointofintersection.h"
|
||||
#include "tools/dialoglineintersectaxis.h"
|
||||
#include "tools/dialogcurveintersectaxis.h"
|
||||
#include "tools/dialogpointofintersectionarcs.h"
|
||||
|
||||
#include "app/dialoghistory.h"
|
||||
#include "app/dialogincrements.h"
|
||||
|
|
|
@ -44,7 +44,8 @@ HEADERS += \
|
|||
$$PWD/tools/dialogcurveintersectaxis.h \
|
||||
$$PWD/app/dialoglayoutsettings.h \
|
||||
$$PWD/app/dialoglayoutprogress.h \
|
||||
dialogs/app/dialogsavelayout.h
|
||||
$$PWD/app/dialogsavelayout.h \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/tools/dialogtriangle.cpp \
|
||||
|
@ -87,7 +88,8 @@ SOURCES += \
|
|||
$$PWD/tools/dialogcurveintersectaxis.cpp \
|
||||
$$PWD/app/dialoglayoutsettings.cpp \
|
||||
$$PWD/app/dialoglayoutprogress.cpp \
|
||||
dialogs/app/dialogsavelayout.cpp
|
||||
$$PWD/app/dialogsavelayout.cpp \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.cpp
|
||||
|
||||
FORMS += \
|
||||
$$PWD/tools/dialogtriangle.ui \
|
||||
|
@ -124,4 +126,5 @@ FORMS += \
|
|||
$$PWD/tools/dialogcurveintersectaxis.ui \
|
||||
$$PWD/app/dialoglayoutsettings.ui \
|
||||
$$PWD/app/dialoglayoutprogress.ui \
|
||||
dialogs/app/dialogsavelayout.ui
|
||||
$$PWD/app/dialogsavelayout.ui \
|
||||
$$PWD/tools/dialogpointofintersectionarcs.ui
|
||||
|
|
|
@ -165,17 +165,7 @@ void DialogPointOfIntersection::PointNameChanged()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersection::ShowVisualization()
|
||||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
VisToolPointOfIntersection *toolVis = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
SCASSERT(toolVis != nullptr);
|
||||
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, toolVis, &Visualization::SetFactor);
|
||||
toolVis->RefreshGeometry();
|
||||
}
|
||||
AddVisualization<VisToolPointOfIntersection>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
235
src/app/dialogs/tools/dialogpointofintersectionarcs.cpp
Normal file
235
src/app/dialogs/tools/dialogpointofintersectionarcs.cpp
Normal file
|
@ -0,0 +1,235 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpointofintersectionarcs.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "dialogpointofintersectionarcs.h"
|
||||
#include "ui_dialogpointofintersectionarcs.h"
|
||||
|
||||
#include "../../libs/vgeometry/vpointf.h"
|
||||
#include "../../container/vcontainer.h"
|
||||
#include "../../visualization/vistoolpointofintersectionarcs.h"
|
||||
#include "../../widgets/vmaingraphicsscene.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersectionArcs::DialogPointOfIntersectionArcs(const VContainer *data, const quint32 &toolId,
|
||||
QWidget *parent)
|
||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersectionArcs)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->lineEditNamePoint->setText(qApp->getCurrentDocument()->GenerateLabel(LabelType::NewLabel));
|
||||
labelEditNamePoint = ui->labelEditNamePoint;
|
||||
|
||||
InitOkCancelApply(ui);
|
||||
CheckState();
|
||||
|
||||
FillComboBoxArcs(ui->comboBoxArc1);
|
||||
FillComboBoxArcs(ui->comboBoxArc2);
|
||||
FillComboBoxCrossArcPoints();
|
||||
|
||||
connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogPointOfIntersectionArcs::NamePointChanged);
|
||||
connect(ui->comboBoxArc1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPointOfIntersectionArcs::ArcChanged);
|
||||
connect(ui->comboBoxArc1, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPointOfIntersectionArcs::ArcChanged);
|
||||
|
||||
vis = new VisToolPointOfIntersectionArcs(data);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPointOfIntersectionArcs::~DialogPointOfIntersectionArcs()
|
||||
{
|
||||
DeleteVisualization<VisToolPointOfIntersectionArcs>();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SetPointName(const QString &value)
|
||||
{
|
||||
pointName = value;
|
||||
ui->lineEditNamePoint->setText(pointName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointOfIntersectionArcs::GetFirstArcId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxArc1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SetFirstArcId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxArc1, value);
|
||||
|
||||
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setArc1Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 DialogPointOfIntersectionArcs::GetSecondArcId() const
|
||||
{
|
||||
return getCurrentObjectId(ui->comboBoxArc2);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
|
||||
{
|
||||
setCurrentPointId(ui->comboBoxArc2, value);
|
||||
|
||||
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setArc2Id(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossArcsPoint DialogPointOfIntersectionArcs::GetCrossArcPoint() const
|
||||
{
|
||||
int value;
|
||||
bool ok = false;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
|
||||
value = ui->comboBoxResult->itemData(box->currentIndex()).toInt(&ok);
|
||||
#else
|
||||
value = ui->comboBoxResult->currentData().toInt(&ok);
|
||||
#endif
|
||||
if (not ok)
|
||||
{
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
}
|
||||
|
||||
switch(value)
|
||||
{
|
||||
case 1:
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
case 2:
|
||||
return CrossArcsPoint::SecondPoint;
|
||||
break;
|
||||
default:
|
||||
return CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SetCrossArcPoint(CrossArcsPoint &p)
|
||||
{
|
||||
const qint32 index = ui->comboBoxResult->findData(static_cast<int>(p));
|
||||
if (index != -1)
|
||||
{
|
||||
ui->comboBoxResult->setCurrentIndex(index);
|
||||
|
||||
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
point->setCrossPoint(p);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::ChosenObject(quint32 id, const SceneObject &type)
|
||||
{
|
||||
if (prepare == false)// After first choose we ignore all objects
|
||||
{
|
||||
if (type == SceneObject::Arc)
|
||||
{
|
||||
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
switch (number)
|
||||
{
|
||||
case 0:
|
||||
if (SetObject(id, ui->comboBoxArc1, tr("Select second an arc")))
|
||||
{
|
||||
number++;
|
||||
point->VisualMode(id);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (getCurrentObjectId(ui->comboBoxArc1) != id)
|
||||
{
|
||||
if (SetObject(id, ui->comboBoxArc2, ""))
|
||||
{
|
||||
number = 0;
|
||||
point->setArc2Id(id);
|
||||
point->RefreshGeometry();
|
||||
prepare = true;
|
||||
this->setModal(true);
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::ArcChanged()
|
||||
{
|
||||
QColor color = okColor;
|
||||
if (getCurrentObjectId(ui->comboBoxArc1) == getCurrentObjectId(ui->comboBoxArc2))
|
||||
{
|
||||
flagError = false;
|
||||
color = errorColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
flagError = true;
|
||||
color = okColor;
|
||||
}
|
||||
ChangeColor(ui->labelArc1, color);
|
||||
ChangeColor(ui->labelArc2, color);
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::ShowVisualization()
|
||||
{
|
||||
AddVisualization<VisToolPointOfIntersectionArcs>();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::SaveData()
|
||||
{
|
||||
pointName = ui->lineEditNamePoint->text();
|
||||
|
||||
VisToolPointOfIntersectionArcs *point = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(point != nullptr);
|
||||
|
||||
point->setArc1Id(GetFirstArcId());
|
||||
point->setArc2Id(GetSecondArcId());
|
||||
point->setCrossPoint(GetCrossArcPoint());
|
||||
point->RefreshGeometry();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPointOfIntersectionArcs::FillComboBoxCrossArcPoints()
|
||||
{
|
||||
ui->comboBoxResult->addItem(tr("First point"), QVariant(static_cast<int>(CrossArcsPoint::FirstPoint)));
|
||||
ui->comboBoxResult->addItem(tr("Second point"), QVariant(static_cast<int>(CrossArcsPoint::SecondPoint)));
|
||||
}
|
78
src/app/dialogs/tools/dialogpointofintersectionarcs.h
Normal file
78
src/app/dialogs/tools/dialogpointofintersectionarcs.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialogpointofintersectionarcs.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef DIALOGPOINTOFINTERSECTIONARCS_H
|
||||
#define DIALOGPOINTOFINTERSECTIONARCS_H
|
||||
|
||||
#include "dialogtool.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogPointOfIntersectionArcs;
|
||||
}
|
||||
|
||||
class DialogPointOfIntersectionArcs : public DialogTool
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogPointOfIntersectionArcs(const VContainer *data, const quint32 &toolId, QWidget *parent = 0);
|
||||
virtual ~DialogPointOfIntersectionArcs();
|
||||
|
||||
void SetPointName(const QString &value);
|
||||
|
||||
quint32 GetFirstArcId() const;
|
||||
void SetFirstArcId(const quint32 &value);
|
||||
|
||||
quint32 GetSecondArcId() const;
|
||||
void SetSecondArcId(const quint32 &value);
|
||||
|
||||
CrossArcsPoint GetCrossArcPoint() const;
|
||||
void SetCrossArcPoint(CrossArcsPoint &p);
|
||||
|
||||
public slots:
|
||||
virtual void ChosenObject(quint32 id, const SceneObject &type);
|
||||
virtual void ArcChanged();
|
||||
|
||||
protected:
|
||||
virtual void ShowVisualization();
|
||||
/**
|
||||
* @brief SaveData Put dialog data in local variables
|
||||
*/
|
||||
virtual void SaveData();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPointOfIntersectionArcs)
|
||||
|
||||
Ui::DialogPointOfIntersectionArcs *ui;
|
||||
|
||||
void FillComboBoxCrossArcPoints();
|
||||
};
|
||||
|
||||
#endif // DIALOGPOINTOFINTERSECTIONARCS_H
|
149
src/app/dialogs/tools/dialogpointofintersectionarcs.ui
Normal file
149
src/app/dialogs/tools/dialogpointofintersectionarcs.ui
Normal file
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogPointOfIntersectionArcs</class>
|
||||
<widget class="QDialog" name="DialogPointOfIntersectionArcs">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>179</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEditNamePoint">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Point label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditNamePoint"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelArc1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>First arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxArc1">
|
||||
<property name="toolTip">
|
||||
<string>Selected arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelArc2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Second arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxArc2">
|
||||
<property name="toolTip">
|
||||
<string>Selected arc</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Take</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxResult"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogPointOfIntersectionArcs</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogPointOfIntersectionArcs</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -695,6 +695,16 @@ void MainWindow::ToolCurveIntersectAxis(bool checked)
|
|||
&MainWindow::ApplyDialog<VToolCurveIntersectAxis>);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToolPointOfIntersectionArcs(bool checked)
|
||||
{
|
||||
SetToolButtonWithApply<DialogPointOfIntersectionArcs>(checked, Tool::PointOfIntersectionArcs,
|
||||
"://cursor/point_of_intersection_arcs.png",
|
||||
tr("Select first an arc"),
|
||||
&MainWindow::ClosedDialogWithApply<VToolPointOfIntersectionArcs>,
|
||||
&MainWindow::ApplyDialog<VToolPointOfIntersectionArcs>);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief About show widows about.
|
||||
|
@ -990,6 +1000,7 @@ void MainWindow::InitToolButtons()
|
|||
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonArcIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonLayoutSettings, &QToolButton::clicked, this, &MainWindow::ToolLayoutSettings);
|
||||
connect(ui->toolButtonPointOfIntersectionArcs, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersectionArcs);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1103,6 +1114,9 @@ void MainWindow::CancelTool()
|
|||
ui->toolButtonCurveIntersectAxis->setChecked(false);
|
||||
ui->toolButtonArcIntersectAxis->setChecked(false);
|
||||
break;
|
||||
case Tool::PointOfIntersectionArcs:
|
||||
ui->toolButtonPointOfIntersectionArcs->setChecked(false);
|
||||
break;
|
||||
case Tool::NodePoint:
|
||||
case Tool::NodeArc:
|
||||
case Tool::NodeSpline:
|
||||
|
@ -2128,6 +2142,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
ui->toolButtonLineIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonCurveIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonArcIntersectAxis->setEnabled(drawTools);
|
||||
ui->toolButtonPointOfIntersectionArcs->setEnabled(drawTools);
|
||||
|
||||
ui->actionLast_tool->setEnabled(drawTools);
|
||||
|
||||
|
@ -2462,6 +2477,10 @@ void MainWindow::LastUsedTool()
|
|||
ui->toolButtonPointOfIntersection->setChecked(true);
|
||||
ToolPointOfIntersection(true);
|
||||
break;
|
||||
case Tool::PointOfIntersectionArcs:
|
||||
ui->toolButtonPointOfIntersectionArcs->setChecked(true);
|
||||
ToolPointOfIntersectionArcs(true);
|
||||
break;
|
||||
case Tool::CutSpline:
|
||||
ui->toolButtonSplineCutPoint->setChecked(true);
|
||||
ToolCutSpline(true);
|
||||
|
|
|
@ -115,6 +115,7 @@ public slots:
|
|||
void ToolCutArc(bool checked);
|
||||
void ToolLineIntersectAxis(bool checked);
|
||||
void ToolCurveIntersectAxis(bool checked);
|
||||
void ToolPointOfIntersectionArcs(bool checked);
|
||||
|
||||
void ClosedDialogDetail(int result);
|
||||
void ClosedDialogUnionDetails(int result);
|
||||
|
|
|
@ -43,14 +43,14 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>272</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -337,7 +337,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -413,7 +413,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -662,6 +662,32 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QToolButton" name="toolButtonPointOfIntersectionArcs">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Point of intersection arcs</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/point_of_intersection_arcs.png</normaloff>:/icon/32x32/point_of_intersection_arcs.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_5">
|
||||
|
@ -669,7 +695,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<width>100</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -745,8 +771,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<height>380</height>
|
||||
<width>98</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
|
|
|
@ -86,14 +86,15 @@ enum class Tool : unsigned char
|
|||
Height,
|
||||
Triangle,
|
||||
LineIntersectAxis,
|
||||
PointOfIntersectionArcs,
|
||||
CurveIntersectAxis,
|
||||
PointOfIntersection,
|
||||
UnionDetails // 30
|
||||
UnionDetails // 31
|
||||
};
|
||||
|
||||
enum class Vis : unsigned char
|
||||
{
|
||||
ControlPointSpline = 31, // increase this value if need more positions in Tool enum
|
||||
ControlPointSpline = 32, // increase this value if need more positions in Tool enum
|
||||
GraphicsSimpleTextItem,
|
||||
SimpleSplinePath,
|
||||
Line,
|
||||
|
@ -109,6 +110,7 @@ enum class Vis : unsigned char
|
|||
ToolNormal,
|
||||
ToolPointOfContact,
|
||||
ToolPointOfIntersection,
|
||||
ToolPointOfIntersectionArcs,
|
||||
ToolShoulderPoint,
|
||||
ToolSpline,
|
||||
ToolTriangle,
|
||||
|
|
|
@ -24,5 +24,6 @@
|
|||
<file>cursor/line_intersect_axis_cursor.png</file>
|
||||
<file>cursor/arc_intersect_axis_cursor.png</file>
|
||||
<file>cursor/curve_intersect_axis_cursor.png</file>
|
||||
<file>cursor/point_of_intersection_arcs.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/app/share/resources/cursor/point_of_intersection_arcs.png
Normal file
BIN
src/app/share/resources/cursor/point_of_intersection_arcs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
|
@ -61,5 +61,6 @@
|
|||
<file>icon/16x16/roll.png</file>
|
||||
<file>icon/16x16/progress.gif</file>
|
||||
<file>icon/32x32/export_to_picture_document.png</file>
|
||||
<file>icon/32x32/point_of_intersection_arcs.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
101
src/app/share/resources/icon/svg/point_of_intersection_arcs.svg
Normal file
101
src/app/share/resources/icon/svg/point_of_intersection_arcs.svg
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
width="32"
|
||||
height="32"
|
||||
id="svg2985"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="point_of_intersection_of_arcs.svg"
|
||||
inkscape:export-filename="/home/dismine/CAD/Valentina/src/app/share/resources/icon/32x32/point_of_contact.png"
|
||||
inkscape:export-xdpi="92"
|
||||
inkscape:export-ydpi="92">
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1855"
|
||||
inkscape:window-height="1056"
|
||||
id="namedview12"
|
||||
showgrid="false"
|
||||
inkscape:zoom="22.378854"
|
||||
inkscape:cx="-0.56014983"
|
||||
inkscape:cy="17.411075"
|
||||
inkscape:window-x="65"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2985" />
|
||||
<defs
|
||||
id="defs2987" />
|
||||
<metadata
|
||||
id="metadata2990">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#0000e6;stroke-width:0.67446876;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path2991"
|
||||
sodipodi:cx="4.9291468"
|
||||
sodipodi:cy="18.508039"
|
||||
sodipodi:rx="3.7284572"
|
||||
sodipodi:ry="12.860018"
|
||||
d="M 3.6065386,6.4843408 A 3.7284572,12.860018 0 1 1 3.554698,30.462368"
|
||||
sodipodi:start="4.3497601"
|
||||
sodipodi:end="8.2315244"
|
||||
transform="matrix(3.9798014,0,0,1.1698978,-13.292682,-5.6561811)"
|
||||
sodipodi:open="true" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:none;stroke:#00b400;stroke-width:0.67446876;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path2991-7"
|
||||
sodipodi:cx="4.9291468"
|
||||
sodipodi:cy="18.508039"
|
||||
sodipodi:rx="3.7284572"
|
||||
sodipodi:ry="12.860018"
|
||||
d="M 3.5137075,6.6107503 A 3.7284572,12.860018 0 1 1 3.6390762,30.573721"
|
||||
sodipodi:start="4.3229912"
|
||||
sodipodi:end="8.207293"
|
||||
transform="matrix(-3.9807445,-0.03406073,0.01952326,-1.170575,44.996104,37.882421)"
|
||||
sodipodi:open="true" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:0.93950177;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-2"
|
||||
d="m 8.0725395,15.941422 a 1.7373301,1.7294948 0 0 1 -3.47466,0 1.7373301,1.7294948 0 1 1 3.47466,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:0.93950177;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9"
|
||||
d="m 27.924666,15.878297 a 1.7373301,1.7294948 0 0 1 -3.47466,0 1.7373301,1.7294948 0 1 1 3.47466,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ff0034;fill-opacity:1;stroke:#ff0034;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-3"
|
||||
d="m 17.586234,4.8245205 a 1.7373301,1.7294948 0 0 1 -3.47466,0 1.7373301,1.7294948 0 1 1 3.47466,0 z" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#ff0034;fill-opacity:1;stroke:#ff0034;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="path2985-2-9-3-5"
|
||||
d="m 17.662266,27.577022 a 1.7373301,1.7294948 0 0 1 -3.47466,0 1.7373301,1.7294948 0 1 1 3.47466,0 z" />
|
||||
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
|
@ -44,6 +44,7 @@
|
|||
#include "vtoolheight.h"
|
||||
#include "vtooltriangle.h"
|
||||
#include "vtoolpointofintersection.h"
|
||||
#include "vtoolpointofintersectionarcs.h"
|
||||
#include "vtoolcutspline.h"
|
||||
#include "vtoolcutsplinepath.h"
|
||||
#include "vtoolcutarc.h"
|
||||
|
|
290
src/app/tools/drawTools/vtoolpointofintersectionarcs.cpp
Normal file
290
src/app/tools/drawTools/vtoolpointofintersectionarcs.cpp
Normal file
|
@ -0,0 +1,290 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtoolpointofintersectionarcs.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vtoolpointofintersectionarcs.h"
|
||||
#include "../../dialogs/tools/dialogpointofintersectionarcs.h"
|
||||
#include "../../libs/vgeometry/vpointf.h"
|
||||
#include "../../libs/vgeometry/varc.h"
|
||||
#include "../../visualization/vistoolpointofintersectionarcs.h"
|
||||
|
||||
const QString VToolPointOfIntersectionArcs::ToolType = QStringLiteral("pointOfIntersectionArcs");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointOfIntersectionArcs::VToolPointOfIntersectionArcs(VPattern *doc, VContainer *data, const quint32 &id,
|
||||
const quint32 &firstArcId, const quint32 &secondArcId,
|
||||
CrossArcsPoint pType, const Source &typeCreation,
|
||||
QGraphicsItem *parent)
|
||||
:VToolPoint(doc, data, id, parent), firstArcId(firstArcId), secondArcId(secondArcId), crossPoint(pType)
|
||||
{
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
AddToFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDataInFile();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::setDialog()
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||
dialogTool->SetFirstArcId(firstArcId);
|
||||
dialogTool->SetSecondArcId(secondArcId);
|
||||
dialogTool->SetCrossArcPoint(crossPoint);
|
||||
dialogTool->SetPointName(p->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(DialogTool *dialog, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
const quint32 firstArcId = dialogTool->GetFirstArcId();
|
||||
const quint32 secondArcId = dialogTool->GetSecondArcId();
|
||||
const CrossArcsPoint pType = dialogTool->GetCrossArcPoint();
|
||||
const QString pointName = dialogTool->getPointName();
|
||||
VToolPointOfIntersectionArcs *point = nullptr;
|
||||
point = Create(0, pointName, firstArcId, secondArcId, pType, 5, 10, scene, doc, data, Document::FullParse,
|
||||
Source::FromGui);
|
||||
if (point != nullptr)
|
||||
{
|
||||
point->dialog=dialogTool;
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(const quint32 _id, const QString &pointName,
|
||||
const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcsPoint pType,
|
||||
const qreal &mx, const qreal &my,
|
||||
VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data, const Document &parse,
|
||||
const Source &typeCreation)
|
||||
{
|
||||
const QSharedPointer<VArc> firstArc = data->GeometricObject<VArc>(firstArcId);
|
||||
const QSharedPointer<VArc> secondArc = data->GeometricObject<VArc>(secondArcId);
|
||||
|
||||
const QPointF point = FindPoint(firstArc.data(), secondArc.data(), pType);
|
||||
quint32 id = _id;
|
||||
if (typeCreation == Source::FromGui)
|
||||
{
|
||||
id = data->AddGObject(new VPointF(point, pointName, mx, my));
|
||||
}
|
||||
else
|
||||
{
|
||||
data->UpdateGObject(id, new VPointF(point, pointName, mx, my));
|
||||
if (parse != Document::FullParse)
|
||||
{
|
||||
doc->UpdateToolData(id, data);
|
||||
}
|
||||
}
|
||||
VDrawTool::AddRecord(id, Tool::PointOfIntersectionArcs, doc);
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
VToolPointOfIntersectionArcs *point = new VToolPointOfIntersectionArcs(doc, data, id, firstArcId,
|
||||
secondArcId, pType, typeCreation);
|
||||
scene->addItem(point);
|
||||
connect(point, &VToolPointOfIntersectionArcs::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPointOfIntersectionArcs::SetFactor);
|
||||
connect(scene, &VMainGraphicsScene::DisableItem, point, &VToolPointOfIntersectionArcs::Disable);
|
||||
connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VToolPointOfIntersectionArcs::EnableToolMove);
|
||||
doc->AddTool(id, point);
|
||||
doc->IncrementReferens(firstArcId);
|
||||
doc->IncrementReferens(secondArcId);
|
||||
return point;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcsPoint pType)
|
||||
{
|
||||
QPointF p1, p2;
|
||||
const int res = VGObject::IntersectionCircles(arc1->GetCenter().toQPointF(), arc1->GetRadius(),
|
||||
arc2->GetCenter().toQPointF(), arc2->GetRadius(), p1, p2);
|
||||
|
||||
switch(res)
|
||||
{
|
||||
case 2:
|
||||
if (pType == CrossArcsPoint::FirstPoint)
|
||||
{
|
||||
return p1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return p2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
return p1;
|
||||
break;
|
||||
case 3:
|
||||
case 0:
|
||||
default:
|
||||
return QPointF(0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointOfIntersectionArcs::GetFirstArcId() const
|
||||
{
|
||||
return firstArcId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SetFirstArcId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
firstArcId = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointOfIntersectionArcs::GetSecondArcId() const
|
||||
{
|
||||
return secondArcId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SetSecondArcId(const quint32 &value)
|
||||
{
|
||||
if (value != NULL_ID)
|
||||
{
|
||||
secondArcId = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
CrossArcsPoint VToolPointOfIntersectionArcs::GetCrossArcsPoint() const
|
||||
{
|
||||
return crossPoint;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SetCrossArcsPoint(CrossArcsPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
|
||||
QSharedPointer<VGObject> obj = VAbstractTool::data.GetGObject(id);
|
||||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::ShowVisualization(bool show)
|
||||
{
|
||||
ShowToolVisualization<VisToolPointOfIntersectionArcs>(show);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::FullUpdateFromFile()
|
||||
{
|
||||
ReadAttributes();
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
SetVisualization();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::RemoveReferens()
|
||||
{
|
||||
doc->DecrementReferens(firstArcId);
|
||||
doc->DecrementReferens(secondArcId);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
ContextMenu<DialogPointOfIntersectionArcs>(this, event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SaveDialog(QDomElement &domElement)
|
||||
{
|
||||
SCASSERT(dialog != nullptr);
|
||||
DialogPointOfIntersectionArcs *dialogTool = qobject_cast<DialogPointOfIntersectionArcs*>(dialog);
|
||||
SCASSERT(dialogTool != nullptr);
|
||||
doc->SetAttribute(domElement, AttrName, dialogTool->getPointName());
|
||||
doc->SetAttribute(domElement, AttrFirstArc, QString().setNum(dialogTool->GetFirstArcId()));
|
||||
doc->SetAttribute(domElement, AttrSecondArc, QString().setNum(dialogTool->GetSecondArcId()));
|
||||
doc->SetAttribute(domElement, AttrCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetCrossArcPoint())));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
||||
{
|
||||
QSharedPointer<VPointF> point = qSharedPointerDynamicCast<VPointF>(obj);
|
||||
SCASSERT(point.isNull() == false);
|
||||
|
||||
doc->SetAttribute(tag, VDomDocument::AttrId, id);
|
||||
doc->SetAttribute(tag, AttrType, ToolType);
|
||||
doc->SetAttribute(tag, AttrName, point->name());
|
||||
doc->SetAttribute(tag, AttrMx, qApp->fromPixel(point->mx()));
|
||||
doc->SetAttribute(tag, AttrMy, qApp->fromPixel(point->my()));
|
||||
|
||||
doc->SetAttribute(tag, AttrFirstArc, firstArcId);
|
||||
doc->SetAttribute(tag, AttrSecondArc, secondArcId);
|
||||
doc->SetAttribute(tag, AttrCrossPoint, static_cast<int>(crossPoint));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElement)
|
||||
{
|
||||
firstArcId = doc->GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR);
|
||||
secondArcId = doc->GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR);
|
||||
crossPoint = static_cast<CrossArcsPoint>(doc->GetParametrUInt(domElement, AttrCrossPoint, "1"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersectionArcs::SetVisualization()
|
||||
{
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolPointOfIntersectionArcs *visual = qobject_cast<VisToolPointOfIntersectionArcs *>(vis);
|
||||
SCASSERT(visual != nullptr);
|
||||
|
||||
visual->setArc1Id(firstArcId);
|
||||
visual->setArc2Id(secondArcId);
|
||||
visual->setCrossPoint(crossPoint);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
89
src/app/tools/drawTools/vtoolpointofintersectionarcs.h
Normal file
89
src/app/tools/drawTools/vtoolpointofintersectionarcs.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtoolpointofintersectionarcs.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 25 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VTOOLPOINTOFINTERSECTIONARCS_H
|
||||
#define VTOOLPOINTOFINTERSECTIONARCS_H
|
||||
|
||||
#include "vtoolpoint.h"
|
||||
#include "../../xml/vpattern.h"
|
||||
|
||||
class VArc;
|
||||
|
||||
class VToolPointOfIntersectionArcs : public VToolPoint
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
VToolPointOfIntersectionArcs(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcsPoint crossPoint, const Source &typeCreation,
|
||||
QGraphicsItem * parent = nullptr);
|
||||
virtual void setDialog();
|
||||
static VToolPointOfIntersectionArcs *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||
VContainer *data);
|
||||
static VToolPointOfIntersectionArcs *Create(const quint32 _id, const QString &pointName, const quint32 &firstArcId,
|
||||
const quint32 &secondArcId, CrossArcsPoint crossPoint,
|
||||
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||
VPattern *doc, VContainer *data, const Document &parse,
|
||||
const Source &typeCreation);
|
||||
static QPointF FindPoint(const VArc *arc1, const VArc *arc2, const CrossArcsPoint crossPoint);
|
||||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::PointOfIntersectionArcs) };
|
||||
|
||||
quint32 GetFirstArcId() const;
|
||||
void SetFirstArcId(const quint32 &value);
|
||||
|
||||
quint32 GetSecondArcId() const;
|
||||
void SetSecondArcId(const quint32 &value);
|
||||
|
||||
CrossArcsPoint GetCrossArcsPoint() const;
|
||||
void SetCrossArcsPoint(CrossArcsPoint &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
protected:
|
||||
virtual void RemoveReferens();
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void SaveDialog(QDomElement &domElement);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement);
|
||||
virtual void SetVisualization();
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolPointOfIntersectionArcs)
|
||||
|
||||
/** @brief firstArcId id first arc. */
|
||||
quint32 firstArcId;
|
||||
|
||||
/** @brief secondArcId id second arc. */
|
||||
quint32 secondArcId;
|
||||
|
||||
CrossArcsPoint crossPoint;
|
||||
};
|
||||
|
||||
#endif // VTOOLPOINTOFINTERSECTIONARCS_H
|
|
@ -38,7 +38,8 @@ HEADERS += \
|
|||
$$PWD/drawTools/vabstractspline.h \
|
||||
$$PWD/drawTools/vtoolcut.h \
|
||||
$$PWD/drawTools/vtoollineintersectaxis.h \
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.h
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.h \
|
||||
$$PWD/drawTools/vtoolpointofintersectionarcs.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vtooldetail.cpp \
|
||||
|
@ -74,4 +75,5 @@ SOURCES += \
|
|||
$$PWD/drawTools/vabstractspline.cpp \
|
||||
$$PWD/drawTools/vtoolcut.cpp \
|
||||
$$PWD/drawTools/vtoollineintersectaxis.cpp \
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.cpp
|
||||
$$PWD/drawTools/vtoolcurveintersectaxis.cpp \
|
||||
$$PWD/drawTools/vtoolpointofintersectionarcs.cpp
|
||||
|
|
|
@ -76,6 +76,9 @@ const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2");
|
|||
const QString VAbstractTool::AttrCurve = QStringLiteral("curve");
|
||||
const QString VAbstractTool::AttrLineColor = QStringLiteral("lineColor");
|
||||
const QString VAbstractTool::AttrColor = QStringLiteral("color");
|
||||
const QString VAbstractTool::AttrFirstArc = QStringLiteral("firstArc");
|
||||
const QString VAbstractTool::AttrSecondArc = QStringLiteral("secondArc");
|
||||
const QString VAbstractTool::AttrCrossPoint = QStringLiteral("crossPoint");
|
||||
|
||||
const QString VAbstractTool::TypeLineNone = QStringLiteral("none");
|
||||
const QString VAbstractTool::TypeLineLine = QStringLiteral("hair");
|
||||
|
|
|
@ -91,6 +91,9 @@ public:
|
|||
static const QString AttrCurve;
|
||||
static const QString AttrLineColor;
|
||||
static const QString AttrColor;
|
||||
static const QString AttrFirstArc;
|
||||
static const QString AttrSecondArc;
|
||||
static const QString AttrCrossPoint;
|
||||
|
||||
static const QString TypeLineNone;
|
||||
static const QString TypeLineLine;
|
||||
|
|
101
src/app/visualization/vistoolpointofintersectionarcs.cpp
Normal file
101
src/app/visualization/vistoolpointofintersectionarcs.cpp
Normal file
|
@ -0,0 +1,101 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointofintersectionarcs.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 27 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vistoolpointofintersectionarcs.h"
|
||||
#include "../libs/vgeometry/varc.h"
|
||||
#include "../container/vcontainer.h"
|
||||
#include "../tools/drawTools/vtoolpointofintersectionarcs.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent)
|
||||
: VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossArcsPoint::FirstPoint), point(nullptr),
|
||||
arc1Path(nullptr), arc2Path(nullptr)
|
||||
{
|
||||
arc1Path = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
|
||||
arc1Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
arc2Path = InitItem<QGraphicsPathItem>(Qt::darkRed, this);
|
||||
arc2Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
|
||||
point = InitPoint(mainColor, this);
|
||||
point->setZValue(2);
|
||||
point->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VisToolPointOfIntersectionArcs::~VisToolPointOfIntersectionArcs()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::RefreshGeometry()
|
||||
{
|
||||
if (arc1Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VArc> arc1 = Visualization::data->GeometricObject<VArc>(arc1Id);
|
||||
DrawPath(arc1Path, arc1->GetPath(PathDirection::Show), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
if (arc2Id > NULL_ID)
|
||||
{
|
||||
const QSharedPointer<VArc> arc2 = Visualization::data->GeometricObject<VArc>(arc2Id);
|
||||
DrawPath(arc2Path, arc2->GetPath(PathDirection::Show), Qt::darkRed, Qt::SolidLine, Qt::RoundCap);
|
||||
|
||||
const QPointF fPoint = VToolPointOfIntersectionArcs::FindPoint(arc1.data(), arc2.data(), crossPoint);
|
||||
DrawPoint(point, fPoint, mainColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::VisualMode(const quint32 &id)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->arc1Id = id;
|
||||
Visualization::scenePos = scene->getScenePos();
|
||||
RefreshGeometry();
|
||||
|
||||
AddOnScene();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::setArc1Id(const quint32 &value)
|
||||
{
|
||||
arc1Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::setArc2Id(const quint32 &value)
|
||||
{
|
||||
arc2Id = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossArcsPoint &value)
|
||||
{
|
||||
crossPoint = value;
|
||||
}
|
61
src/app/visualization/vistoolpointofintersectionarcs.h
Normal file
61
src/app/visualization/vistoolpointofintersectionarcs.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vistoolpointofintersectionarcs.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 27 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina 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 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina 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 Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VISTOOLPOINTOFINTERSECTIONARCS_H
|
||||
#define VISTOOLPOINTOFINTERSECTIONARCS_H
|
||||
|
||||
#include "visline.h"
|
||||
#include "../xml/vpattern.h"
|
||||
|
||||
class VisToolPointOfIntersectionArcs : public VisLine
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent = 0);
|
||||
virtual ~VisToolPointOfIntersectionArcs();
|
||||
|
||||
virtual void RefreshGeometry();
|
||||
virtual void VisualMode(const quint32 &id);
|
||||
|
||||
void setArc1Id(const quint32 &value);
|
||||
void setArc2Id(const quint32 &value);
|
||||
void setCrossPoint(const CrossArcsPoint &value);
|
||||
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::ToolPointOfIntersection)};
|
||||
private:
|
||||
Q_DISABLE_COPY(VisToolPointOfIntersectionArcs)
|
||||
quint32 arc1Id;
|
||||
quint32 arc2Id;
|
||||
CrossArcsPoint crossPoint;
|
||||
QGraphicsEllipseItem *point;
|
||||
QGraphicsPathItem *arc1Path;
|
||||
QGraphicsPathItem *arc2Path;
|
||||
};
|
||||
|
||||
#endif // VISTOOLPOINTOFINTERSECTIONARCS_H
|
|
@ -52,7 +52,7 @@ public:
|
|||
void setPoint1Id(const quint32 &value);
|
||||
void setLineStyle(const Qt::PenStyle &value);
|
||||
void setScenePos(const QPointF &value);
|
||||
void VisualMode(const quint32 &pointId);
|
||||
virtual void VisualMode(const quint32 &pointId);
|
||||
void setMainColor(const QColor &value);
|
||||
signals:
|
||||
void ToolTip(const QString &toolTip);
|
||||
|
|
|
@ -26,7 +26,8 @@ HEADERS += \
|
|||
$$PWD/vistoolsplinepath.h \
|
||||
$$PWD/vistoolcutsplinepath.h \
|
||||
$$PWD/vistoollineintersectaxis.h \
|
||||
$$PWD/vistoolcurveintersectaxis.h
|
||||
$$PWD/vistoolcurveintersectaxis.h \
|
||||
$$PWD/vistoolpointofintersectionarcs.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vgraphicssimpletextitem.cpp \
|
||||
|
@ -53,4 +54,5 @@ SOURCES += \
|
|||
$$PWD/vistoolsplinepath.cpp \
|
||||
$$PWD/vistoolcutsplinepath.cpp \
|
||||
$$PWD/vistoollineintersectaxis.cpp \
|
||||
$$PWD/vistoolcurveintersectaxis.cpp
|
||||
$$PWD/vistoolcurveintersectaxis.cpp \
|
||||
$$PWD/vistoolpointofintersectionarcs.cpp
|
||||
|
|
|
@ -116,6 +116,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
|
|||
case VToolPointOfIntersection::Type:
|
||||
ShowOptionsToolPointOfIntersection(item);
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
ShowOptionsToolPointOfIntersectionArcs(item);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ShowOptionsToolShoulderPoint(item);
|
||||
break;
|
||||
|
@ -203,6 +206,9 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
|
|||
case VToolPointOfIntersection::Type:
|
||||
UpdateOptionsToolPointOfIntersection();
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
UpdateOptionsToolPointOfIntersectionArcs();
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
UpdateOptionsToolShoulderPoint();
|
||||
break;
|
||||
|
@ -305,6 +311,9 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
|
|||
case VToolPointOfIntersection::Type:
|
||||
ChangeDataToolPointOfIntersection(prop);
|
||||
break;
|
||||
case VToolPointOfIntersectionArcs::Type:
|
||||
ChangeDataToolPointOfIntersectionArcs(prop);
|
||||
break;
|
||||
case VToolShoulderPoint::Type:
|
||||
ChangeDataToolShoulderPoint(prop);
|
||||
break;
|
||||
|
@ -388,6 +397,16 @@ void VToolOptionsPropertyBrowser::AddPropertyPointName(Tool *i, const QString &p
|
|||
AddProperty(itemName, VAbstractTool::AttrName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
VEnumProperty* itemProperty = new VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossArcsPoint())-1);
|
||||
AddProperty(itemProperty, VAbstractTool::AttrCrossPoint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template<class Tool>
|
||||
void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName,
|
||||
|
@ -827,6 +846,52 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersection(VProperty *p
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VProperty *property)
|
||||
{
|
||||
SCASSERT(property != nullptr)
|
||||
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole);
|
||||
const QString id = propertyToId[property];
|
||||
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
SCASSERT(i != nullptr);
|
||||
switch (PropertiesList().indexOf(id))
|
||||
{
|
||||
case 0: // VAbstractTool::AttrName
|
||||
SetPointName<VToolPointOfIntersectionArcs>(value.toString());
|
||||
break;
|
||||
case 28: // VAbstractTool::AttrCrossPoint
|
||||
{
|
||||
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole);
|
||||
bool ok = false;
|
||||
const int val = value.toInt(&ok);
|
||||
|
||||
CrossArcsPoint cross = CrossArcsPoint::FirstPoint;
|
||||
if (ok)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case 0:
|
||||
cross = CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
case 1:
|
||||
cross = CrossArcsPoint::SecondPoint;
|
||||
break;
|
||||
default:
|
||||
cross = CrossArcsPoint::FirstPoint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i->SetCrossArcsPoint(cross);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qWarning()<<"Unknown property type. id = "<<id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *property)
|
||||
{
|
||||
|
@ -1171,6 +1236,17 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersection(QGraphicsIt
|
|||
AddPropertyPointName(i, tr("Point label"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item)
|
||||
{
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool to make point from intersection two arcs"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
AddPropertyCrossPoint(i, tr("Take"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *item)
|
||||
{
|
||||
|
@ -1485,6 +1561,15 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersection()
|
|||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolPointOfIntersectionArcs()
|
||||
{
|
||||
VToolPointOfIntersectionArcs *i = qgraphicsitem_cast<VToolPointOfIntersectionArcs *>(currentItem);
|
||||
|
||||
idToProperty[VAbstractTool::AttrName]->setValue(i->name());
|
||||
idToProperty[VAbstractTool::AttrCrossPoint]->setValue(static_cast<int>(i->GetCrossArcsPoint())-1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
|
||||
{
|
||||
|
@ -1611,6 +1696,7 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
|||
<< VAbstractTool::AttrAxisP2 /* 24 */
|
||||
<< VAbstractTool::AttrKCurve /* 25 */
|
||||
<< VAbstractTool::AttrLineColor /* 26 */
|
||||
<< VAbstractTool::AttrColor; /* 27 */
|
||||
<< VAbstractTool::AttrColor /* 27 */
|
||||
<< VAbstractTool::AttrCrossPoint; /* 28 */
|
||||
return attr;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,9 @@ private:
|
|||
template<class Tool>
|
||||
void AddPropertyPointName(Tool *i, const QString &propertyName);
|
||||
|
||||
template<class Tool>
|
||||
void AddPropertyCrossPoint(Tool *i, const QString &propertyName);
|
||||
|
||||
template<class Tool>
|
||||
void AddPropertyLineType(Tool *i, const QString &propertyName, const QMap<QString, QIcon> &styles);
|
||||
|
||||
|
@ -96,6 +99,7 @@ private:
|
|||
void ChangeDataToolNormal(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfContact(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersection(VPE::VProperty *property);
|
||||
void ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property);
|
||||
void ChangeDataToolShoulderPoint(VPE::VProperty *property);
|
||||
void ChangeDataToolSpline(VPE::VProperty *property);
|
||||
void ChangeDataToolSplinePath(VPE::VProperty *property);
|
||||
|
@ -117,6 +121,7 @@ private:
|
|||
void ShowOptionsToolNormal(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfContact(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersection(QGraphicsItem *item);
|
||||
void ShowOptionsToolPointOfIntersectionArcs(QGraphicsItem *item);
|
||||
void ShowOptionsToolShoulderPoint(QGraphicsItem *item);
|
||||
void ShowOptionsToolSpline(QGraphicsItem *item);
|
||||
void ShowOptionsToolSplinePath(QGraphicsItem *item);
|
||||
|
@ -138,6 +143,7 @@ private:
|
|||
void UpdateOptionsToolNormal();
|
||||
void UpdateOptionsToolPointOfContact();
|
||||
void UpdateOptionsToolPointOfIntersection();
|
||||
void UpdateOptionsToolPointOfIntersectionArcs();
|
||||
void UpdateOptionsToolShoulderPoint();
|
||||
void UpdateOptionsToolSpline();
|
||||
void UpdateOptionsToolSplinePath();
|
||||
|
|
|
@ -1142,7 +1142,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
<< VNodePoint::ToolType << VToolHeight::ToolType << VToolTriangle::ToolType
|
||||
<< VToolPointOfIntersection::ToolType << VToolCutSpline::ToolType
|
||||
<< VToolCutSplinePath::ToolType << VToolCutArc::ToolType
|
||||
<< VToolLineIntersectAxis::ToolType << VToolCurveIntersectAxis::ToolType;
|
||||
<< VToolLineIntersectAxis::ToolType << VToolCurveIntersectAxis::ToolType
|
||||
<< VToolPointOfIntersectionArcs::ToolType;
|
||||
switch (points.indexOf(type))
|
||||
{
|
||||
case 0: //VToolSinglePoint::ToolType
|
||||
|
@ -1633,6 +1634,26 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
|
|||
throw excep;
|
||||
}
|
||||
break;
|
||||
case 17: //VToolPointOfIntersectionArcs::ToolType
|
||||
try
|
||||
{
|
||||
PointsCommonAttributes(domElement, id, name, mx, my);
|
||||
const quint32 firstArcId = GetParametrUInt(domElement, VAbstractTool::AttrFirstArc, NULL_ID_STR);
|
||||
const quint32 secondArcId = GetParametrUInt(domElement, VAbstractTool::AttrSecondArc, NULL_ID_STR);
|
||||
const CrossArcsPoint crossPoint = static_cast<CrossArcsPoint>(GetParametrUInt(domElement,
|
||||
VAbstractTool::AttrCrossPoint,
|
||||
"1"));
|
||||
|
||||
VToolPointOfIntersectionArcs::Create(id, name, firstArcId, secondArcId, crossPoint, mx, my, scene, this,
|
||||
data, parse, Source::FromFile);
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
VExceptionObjectError excep(tr("Error creating or updating point of intersection arcs"), domElement);
|
||||
excep.AddMoreInformation(e.ErrorMessage());
|
||||
throw excep;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Illegal point type in VDomDocument::ParsePointElement().";
|
||||
break;
|
||||
|
|
|
@ -38,6 +38,7 @@ class VMainGraphicsScene;
|
|||
|
||||
enum class Document : char { LiteParse, LitePPParse, FullParse };
|
||||
enum class LabelType : char {NewPatternPiece, NewLabel};
|
||||
enum class CrossArcsPoint : char {FirstPoint = 1, SecondPoint = 2};
|
||||
|
||||
/**
|
||||
* @brief The VPattern class working with pattern file.
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
<file>schema/pattern/v0.1.1.xsd</file>
|
||||
<file>schema/pattern/v0.1.2.xsd</file>
|
||||
<file>schema/pattern/v0.1.3.xsd</file>
|
||||
<file>schema/pattern/v0.1.4.xsd</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
312
src/libs/ifc/schema/pattern/v0.1.4.xsd
Normal file
312
src/libs/ifc/schema/pattern/v0.1.4.xsd
Normal file
|
@ -0,0 +1,312 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
<!-- XML Schema Generated from XML Document-->
|
||||
<xs:element name="pattern">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:element name="version" type="formatVersion"></xs:element>
|
||||
<xs:element name="author" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="notes" type="xs:string" minOccurs="0" maxOccurs="1"></xs:element>
|
||||
<xs:element name="gradation" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="heights">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
|
||||
<xs:attribute name="h92" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h98" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h104" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h110" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h116" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h122" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h128" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h134" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h140" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h146" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h152" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h158" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h164" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h170" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h176" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h182" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h188" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="h194" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="sizes">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="all" type="xs:boolean" use="required"></xs:attribute>
|
||||
<xs:attribute name="s22" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s24" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s26" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s28" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s30" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s32" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s34" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s36" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s38" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s40" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s42" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s44" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s46" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s48" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s50" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s52" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s54" type="xs:boolean"></xs:attribute>
|
||||
<xs:attribute name="s56" type="xs:boolean"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="measurements" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="type" type="measurementsTypes" use="required"></xs:attribute>
|
||||
<xs:attribute name="path" type="xs:string" use="required"></xs:attribute>
|
||||
<xs:attribute name="unit" type="units" use="required"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="increments" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="increment" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="ksize" type="xs:double" use="required"></xs:attribute>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="description" type="xs:string" use="required"></xs:attribute>
|
||||
<xs:attribute name="kgrowth" type="xs:double" use="required"></xs:attribute>
|
||||
<xs:attribute name="name" type="shortName" use="required"></xs:attribute>
|
||||
<xs:attribute name="base" type="xs:double" use="required"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="draw" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="calculation" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="x" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="y" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="name" type="shortName"></xs:attribute>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="thirdPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="basePoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="pShoulder" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="length" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="angle" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="splinePath" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="spline" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p1Line2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="p2Line2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="axisP1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="axisP2" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="arc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="curve" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="lineColor" type="colors"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
<xs:attribute name="firstArc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondArc" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="crossPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="line" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="firstPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="secondPoint" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeLine" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="lineColor" type="colors"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="angle1" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="radius" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="center" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="pathPoint" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="kAsm2" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="pSpline" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="angle" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="kAsm1" type="xs:string"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="kCurve" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="kAsm1" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="kAsm2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="angle1" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="angle2" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="point1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="point4" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="color" type="colors"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="modeling" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="point" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="arc" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="spline" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="typeObject" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idTool" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="tools" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="det" minOccurs="2" maxOccurs="2">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="indexD1" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="indexD2" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="details" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="node" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="nodeType" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="idObject" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="type" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="reverse" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="id" type="xs:unsignedInt" use="required"></xs:attribute>
|
||||
<xs:attribute name="supplement" type="xs:unsignedInt"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="width" type="xs:double"></xs:attribute>
|
||||
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||
<xs:attribute name="closed" type="xs:unsignedInt"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:simpleType name="shortName">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^([^0-9*/^+\-=\s()?%:;!.,`'\"]){1,1}([^*/^+\-=\s()?%:;!.,`'\"]){0,}$"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="units">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="mm"/>
|
||||
<xs:enumeration value="cm"/>
|
||||
<xs:enumeration value="inch"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="measurementsTypes">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="standard"/>
|
||||
<xs:enumeration value="individual"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="formatVersion">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="^(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))$"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="colors">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="black"/>
|
||||
<xs:enumeration value="green"/>
|
||||
<xs:enumeration value="blue"/>
|
||||
<xs:enumeration value="darkRed"/>
|
||||
<xs:enumeration value="darkGreen"/>
|
||||
<xs:enumeration value="darkBlue"/>
|
||||
<xs:enumeration value="yellow"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:schema>
|
|
@ -40,8 +40,8 @@
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.1.3");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.1.3.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.1.4");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.1.4.xsd");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPatternConverter::VPatternConverter(const QString &fileName)
|
||||
|
@ -93,6 +93,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
case (0x000102):
|
||||
return QStringLiteral("://schema/pattern/v0.1.2.xsd");
|
||||
case (0x000103):
|
||||
return QStringLiteral("://schema/pattern/v0.1.3.xsd");
|
||||
case (0x000104):
|
||||
return CurrentSchema;
|
||||
default:
|
||||
{
|
||||
|
@ -140,6 +142,16 @@ void VPatternConverter::ApplyPatches()
|
|||
#endif
|
||||
}
|
||||
case (0x000103):
|
||||
{
|
||||
ToV0_1_4();
|
||||
const QString schema = XSDSchema(0x000104);
|
||||
ValidateXML(schema, fileName);
|
||||
// continue conversion
|
||||
#ifdef Q_CC_CLANG
|
||||
[[clang::fallthrough]];
|
||||
#endif
|
||||
}
|
||||
case (0x000104):
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -184,3 +196,10 @@ void VPatternConverter::ToV0_1_3()
|
|||
SetVersion(QStringLiteral("0.1.3"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_1_4()
|
||||
{
|
||||
SetVersion(QStringLiteral("0.1.4"));
|
||||
Save();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ private:
|
|||
void ToV0_1_1();
|
||||
void ToV0_1_2();
|
||||
void ToV0_1_3();
|
||||
void ToV0_1_4();
|
||||
};
|
||||
|
||||
#endif // VPATTERNCONVERTER_H
|
||||
|
|
|
@ -260,6 +260,45 @@ QPointF VGObject::LineIntersectRect(const QRectF &rec, const QLineF &line)
|
|||
return point;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int VGObject::IntersectionCircles(const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1, QPointF &p2)
|
||||
{
|
||||
if (qFuzzyCompare(c1.x(), c2.x()) && qFuzzyCompare(c1.y(), c2.y()) && qFuzzyCompare(r1, r2))
|
||||
{
|
||||
return 3;// Circles are equal
|
||||
}
|
||||
const double a = - 2.0 * (c2.x() - c1.x());
|
||||
const double b = - 2.0 * (c2.y() - c1.y());
|
||||
const double c = (c2.x() - c1.x())* (c2.x() - c1.x()) + (c2.y() - c1.y()) * (c2.y() - c1.y()) + r1 * r1 - r2 * r2;
|
||||
|
||||
const double x0 = -a*c/(a*a+b*b);
|
||||
const double y0 = -b*c/(a*a+b*b);
|
||||
|
||||
if (c*c > r1*r1*(a*a+b*b))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (qFuzzyCompare(c*c, r1*r1*(a*a+b*b)))
|
||||
{
|
||||
p1 = QPointF(x0 + c1.x(), y0 + c1.y());
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double d = r1*r1 - c*c/(a*a+b*b);
|
||||
const double mult = sqrt (d / (a*a+b*b));
|
||||
|
||||
const double ax = x0 + b * mult;
|
||||
const double bx = x0 - b * mult;
|
||||
const double ay = y0 - a * mult;
|
||||
const double by = y0 + a * mult;
|
||||
|
||||
p1 = QPointF(ax + c1.x(), ay + c1.y());
|
||||
p2 = QPointF(bx + c1.x(), by + c1.y());
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief LineIntersectCircle find point intersection line and circle.
|
||||
|
@ -276,10 +315,10 @@ qint32 VGObject::LineIntersectCircle(const QPointF ¢er, qreal radius, const
|
|||
qreal a = 0, b = 0, c = 0;
|
||||
LineCoefficients(line, &a, &b, &c);
|
||||
// projection center of circle on to line
|
||||
QPointF p = ClosestPoint (line, center);
|
||||
const QPointF p = ClosestPoint (line, center);
|
||||
// how many solutions?
|
||||
qint32 flag = 0;
|
||||
qreal d = QLineF (center, p).length();
|
||||
const qreal d = QLineF (center, p).length();
|
||||
if (qFuzzyCompare(d, radius))
|
||||
{
|
||||
flag = 1;
|
||||
|
@ -296,8 +335,8 @@ qint32 VGObject::LineIntersectCircle(const QPointF ¢er, qreal radius, const
|
|||
}
|
||||
}
|
||||
// find distance from projection to points of intersection
|
||||
qreal k = qSqrt (qAbs(radius * radius - d * d));
|
||||
qreal t = QLineF (QPointF (0, 0), QPointF (b, - a)).length();
|
||||
const qreal k = qSqrt (qAbs(radius * radius - d * d));
|
||||
const qreal t = QLineF (QPointF (0, 0), QPointF (b, - a)).length();
|
||||
// add to projection a vectors aimed to points of intersection
|
||||
p1 = addVector (p, QPointF (0, 0), QPointF (- b, a), k / t);
|
||||
p2 = addVector (p, QPointF (0, 0), QPointF (b, - a), k / t);
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
static QLineF BuildAxis(const QPointF &p1, const QPointF &p2, const QRectF &scRect);
|
||||
|
||||
static QPointF LineIntersectRect(const QRectF &rec, const QLineF &line);
|
||||
static int IntersectionCircles(const QPointF &c1, double r1, const QPointF &c2, double r2, QPointF &p1,
|
||||
QPointF &p2);
|
||||
static qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1,
|
||||
QPointF &p2);
|
||||
static QPointF ClosestPoint(const QLineF &line, const QPointF &point);
|
||||
|
|
Loading…
Reference in New Issue
Block a user