Merge branch 'develop' into feature/manual-layout
This commit is contained in:
commit
68c6c033b4
|
@ -1,4 +1,4 @@
|
||||||
# Version 0.7.47 (unreleased)
|
# Version 0.7.47 May 13, 2021
|
||||||
- [smart-pattern/valentina#118] Incorrect seam allowance.
|
- [smart-pattern/valentina#118] Incorrect seam allowance.
|
||||||
- [smart-pattern/valentina#119] Improve tool Point of intersection curves.
|
- [smart-pattern/valentina#119] Improve tool Point of intersection curves.
|
||||||
- [smart-pattern/valentina#120] Incorrect seam allowance.
|
- [smart-pattern/valentina#120] Incorrect seam allowance.
|
||||||
|
@ -9,6 +9,10 @@
|
||||||
- [smart-pattern/valentina#123] Error inside Save layout dialog.
|
- [smart-pattern/valentina#123] Error inside Save layout dialog.
|
||||||
- Improve error handling for the dxf export.
|
- Improve error handling for the dxf export.
|
||||||
- Fix correct handle a final measurement formula error when exporting a pattern recipe.
|
- Fix correct handle a final measurement formula error when exporting a pattern recipe.
|
||||||
|
- Fix regression. Incorrect data caching.
|
||||||
|
- Improve tool tooltip. Show segment names and aliases.
|
||||||
|
- Alias support for tools Point of intersection curve and axis and Point of intersection curves.
|
||||||
|
- [smart-pattern/valentina#124] Standard passmarks length for all pieces.
|
||||||
|
|
||||||
# Version 0.7.46 Mar 31, 2021
|
# Version 0.7.46 Mar 31, 2021
|
||||||
- Fix incorrect calculation of value for multisize measurements in Valentina.
|
- Fix incorrect calculation of value for multisize measurements in Valentina.
|
||||||
|
|
12
common.pri
12
common.pri
|
@ -279,12 +279,6 @@ defineReplace(FindBuildRevision){
|
||||||
return(\\\"unknown\\\")
|
return(\\\"unknown\\\")
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
macx{
|
|
||||||
GIT = /usr/local/bin/git # Can't defeat PATH variable on Mac OS.
|
|
||||||
}else {
|
|
||||||
GIT = git # All other platforms are OK.
|
|
||||||
}
|
|
||||||
|
|
||||||
DVCS_HESH=$$system("git rev-parse --short HEAD")
|
DVCS_HESH=$$system("git rev-parse --short HEAD")
|
||||||
isEmpty(DVCS_HESH){
|
isEmpty(DVCS_HESH){
|
||||||
DVCS_HESH = \\\"unknown\\\" # if we can't find build revision left unknown.
|
DVCS_HESH = \\\"unknown\\\" # if we can't find build revision left unknown.
|
||||||
|
@ -301,12 +295,6 @@ defineReplace(FindLatestTagDistance){
|
||||||
return(0)
|
return(0)
|
||||||
}else{
|
}else{
|
||||||
# Release mode
|
# Release mode
|
||||||
#get latest git tag and it's distance from HEAD
|
|
||||||
macx{
|
|
||||||
GIT = /usr/local/bin/git # Can't defeat PATH variable on Mac OS.
|
|
||||||
}else {
|
|
||||||
GIT = GIT # All other platforms all OK.
|
|
||||||
}
|
|
||||||
|
|
||||||
# tag is formatted as TAG-N-gSHA:
|
# tag is formatted as TAG-N-gSHA:
|
||||||
# 1. latest stable version is TAG, or vX.Y.Z
|
# 1. latest stable version is TAG, or vX.Y.Z
|
||||||
|
|
5
dist/AppImage/appimage.yml
vendored
5
dist/AppImage/appimage.yml
vendored
|
@ -40,7 +40,7 @@ build:
|
||||||
# - ....
|
# - ....
|
||||||
#
|
#
|
||||||
files:
|
files:
|
||||||
- "https://gitlab.com/smart-pattern/valentina/repository/archive.tar.gz?ref=develop"
|
- "https://gitlab.com/smart-pattern/valentina/-/archive/develop/valentina-develop.tar.gz"
|
||||||
|
|
||||||
# OPTIONAL: ingredient packages are packages which become part of the AppImage.
|
# OPTIONAL: ingredient packages are packages which become part of the AppImage.
|
||||||
# you may want to remove parts of their content in script section.
|
# you may want to remove parts of their content in script section.
|
||||||
|
@ -53,9 +53,8 @@ script:
|
||||||
# - $BUILD_SOURCE_DIR point to the source directory
|
# - $BUILD_SOURCE_DIR point to the source directory
|
||||||
# - $BUILD_APPDIR point to the AppDir. This directory will become the content of the AppImage
|
# - $BUILD_APPDIR point to the AppDir. This directory will become the content of the AppImage
|
||||||
- cd $BUILD_SOURCE_DIR
|
- cd $BUILD_SOURCE_DIR
|
||||||
- mv -v "archive.tar.gz?ref=develop" valentina-develop.tar.gz
|
|
||||||
- tar zxvf $BUILD_SOURCE_DIR/valentina-develop.tar.gz
|
- tar zxvf $BUILD_SOURCE_DIR/valentina-develop.tar.gz
|
||||||
- mv -v valentina-develop-* valentina
|
- mv -v valentina-develop valentina
|
||||||
- cd $BUILD_SOURCE_DIR/valentina
|
- cd $BUILD_SOURCE_DIR/valentina
|
||||||
- qmake-qt5 PREFIX=/usr PREFIX_LIB=/usr/lib LRELEASE=lrelease-qt5 Valentina.pro -r DEFINES+=APPIMAGE "CONFIG += noTests noRunPath no_ccache noDebugSymbols"
|
- qmake-qt5 PREFIX=/usr PREFIX_LIB=/usr/lib LRELEASE=lrelease-qt5 Valentina.pro -r DEFINES+=APPIMAGE "CONFIG += noTests noRunPath no_ccache noDebugSymbols"
|
||||||
- make -j$(nproc)
|
- make -j$(nproc)
|
||||||
|
|
4
dist/OBS_debian/debian.changelog
vendored
4
dist/OBS_debian/debian.changelog
vendored
|
@ -1,5 +1,5 @@
|
||||||
valentina (0.7.46) trusty; urgency=low
|
valentina (0.7.47) trusty; urgency=low
|
||||||
|
|
||||||
* Auto build.
|
* Auto build.
|
||||||
|
|
||||||
-- dismine <dismine@dismine-To-be-filled-by-O-E-M> Wed, 31 Mar 2021 17:20:00 +0300
|
-- dismine <dismine@dismine-To-be-filled-by-O-E-M> Fri, 13 May 2021 14:17:00 +0300
|
||||||
|
|
2
dist/OBS_debian/debian.rules
vendored
2
dist/OBS_debian/debian.rules
vendored
|
@ -18,7 +18,7 @@
|
||||||
mkdir -p builddir
|
mkdir -p builddir
|
||||||
|
|
||||||
builddir/Makefile: builddir
|
builddir/Makefile: builddir
|
||||||
cd builddir && qmake PREFIX=/usr PREFIX_LIB=$(PREFIX_LIB) "CONFIG += noTests noRunPath no_ccache noDebugSymbols" ../$(APPNAME).pro -r
|
cd builddir && QT_SELECT=qt5 qmake PREFIX=/usr PREFIX_LIB=$(PREFIX_LIB) "CONFIG += noTests noRunPath no_ccache noDebugSymbols" ../$(APPNAME).pro -r
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
build-stamp: builddir/Makefile
|
build-stamp: builddir/Makefile
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
27
dist/OBS_debian/valentina.dsc
vendored
27
dist/OBS_debian/valentina.dsc
vendored
|
@ -2,25 +2,20 @@ Format: 3.0 (native)
|
||||||
Source: valentina
|
Source: valentina
|
||||||
Binary: valentina
|
Binary: valentina
|
||||||
Architecture: i386 amd64
|
Architecture: i386 amd64
|
||||||
Version: 0.6.0
|
Version: 0.7.47
|
||||||
Maintainer: Roman Telezhynskyi <dismine@gmail.com>
|
Maintainer: Roman Telezhynskyi <dismine@gmail.com>
|
||||||
Homepage: https://valentinaproject.bitbucket.io/
|
Homepage: https://valentinaproject.bitbucket.io
|
||||||
Standards-Version: 3.9.5
|
Standards-Version: 3.9.5
|
||||||
Vcs-Browser: https://bitbucket.org/dismine/valentina
|
Vcs-Browser: https://gitlab.com/smart-pattern/valentina
|
||||||
Build-Depends: debhelper (>= 8.0.0),
|
Build-Depends: debhelper (>= 8.0.0),
|
||||||
qtbase5-dev (>= 5.2.0),
|
qtbase5-dev (>= 5.4.0),
|
||||||
libqt5svg5-dev (>= 5.2.0),
|
libqt5svg5-dev (>= 5.4.0),
|
||||||
g++ (>= 4.7.0),
|
g++ (>= 4.8.0),
|
||||||
qt5-default (>= 5.2.0),
|
qttools5-dev-tools (>= 5.4.0),
|
||||||
qttools5-dev-tools (>= 5.2.0),
|
libqt5xmlpatterns5-dev (>= 5.4.0),
|
||||||
libqt5xmlpatterns5-dev (>= 5.2.0),
|
libqt5opengl5-dev (>= 5.4.0)
|
||||||
libqt5opengl5-dev (>= 5.2.0)
|
Debtransform-Tar: valentina-0.7.47.v0.7.47.tar.gz
|
||||||
Package-List:
|
Package-List:
|
||||||
valentina deb graphics optional
|
valentina deb graphics optional
|
||||||
Files:
|
Files:
|
||||||
d09673bcc475067139b88cf875e5dc0c 20954240 valentina_0.6.0.orig.tar.gz
|
00000000000000000000000000000000 0 valentina-0.7.47.v0.7.47.tar.gz
|
||||||
2fecf324a32123b08cefc0f047bca5ee 63176 valentina_0.6.0.diff.tar.gz
|
|
||||||
|
|
||||||
DEBTRANSFORM-TAR: valentina_0.6.0.orig.tar.gz
|
|
||||||
DEBTRANSFORM-FILES-TAR: debian.tar.gz
|
|
||||||
DEBTRANSFORM-RELEASE: 1
|
|
||||||
|
|
4
dist/debian/changelog
vendored
4
dist/debian/changelog
vendored
|
@ -1,5 +1,5 @@
|
||||||
valentina (0.7.46) trusty; urgency=low
|
valentina (0.7.47) trusty; urgency=low
|
||||||
|
|
||||||
* Auto build.
|
* Auto build.
|
||||||
|
|
||||||
-- dismine <dismine@dismine-To-be-filled-by-O-E-M> Wed, 31 Mar 2021 17:20:00 +0300
|
-- dismine <dismine@dismine-To-be-filled-by-O-E-M> Fri, 13 May 2021 14:17:00 +0300
|
||||||
|
|
2
dist/debian/rules
vendored
2
dist/debian/rules
vendored
|
@ -18,7 +18,7 @@
|
||||||
mkdir -p builddir
|
mkdir -p builddir
|
||||||
|
|
||||||
builddir/Makefile: builddir
|
builddir/Makefile: builddir
|
||||||
cd builddir && qmake PREFIX=/usr PREFIX_LIB=$(PREFIX_LIB) "CONFIG += noTests noRunPath no_ccache noDebugSymbols" ../$(APPNAME).pro -r
|
cd builddir && QT_SELECT=qt5 qmake PREFIX=/usr PREFIX_LIB=$(PREFIX_LIB) "CONFIG += noTests noRunPath no_ccache noDebugSymbols" ../$(APPNAME).pro -r
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
build-stamp: builddir/Makefile
|
build-stamp: builddir/Makefile
|
||||||
dh_testdir
|
dh_testdir
|
||||||
|
|
4
dist/macx/tape/Info.plist
vendored
4
dist/macx/tape/Info.plist
vendored
|
@ -19,9 +19,9 @@
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>io.bitbucket.valentinaproject.@EXECUTABLE@</string>
|
<string>io.bitbucket.valentinaproject.@EXECUTABLE@</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.46</string>
|
<string>0.7.47</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.7.46.0</string>
|
<string>0.7.47.0</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
|
4
dist/macx/valentina/Info.plist
vendored
4
dist/macx/valentina/Info.plist
vendored
|
@ -19,9 +19,9 @@
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>io.bitbucket.valentinaproject.@EXECUTABLE@</string>
|
<string>io.bitbucket.valentinaproject.@EXECUTABLE@</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.7.46</string>
|
<string>0.7.47</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.7.46.0</string>
|
<string>0.7.47.0</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
|
4
dist/rpm/_service
vendored
4
dist/rpm/_service
vendored
|
@ -1,11 +1,11 @@
|
||||||
<services>
|
<services>
|
||||||
<service name="tar_scm">
|
<service name="tar_scm">
|
||||||
<param name="url">git://github.com/dismine/Valentina_git.git</param>
|
<param name="url">git://github.com/dismine/Valentina_git.git</param>
|
||||||
<param name="versionprefix">0.7.46</param>
|
<param name="versionprefix">0.7.47</param>
|
||||||
<param name="filename">valentina</param>
|
<param name="filename">valentina</param>
|
||||||
<param name="scm">git</param>
|
<param name="scm">git</param>
|
||||||
<param name="exclude">.git</param>
|
<param name="exclude">.git</param>
|
||||||
<param name="versionformat">%at</param>
|
<param name="versionformat">@PARENT_TAG@</param>
|
||||||
<param name="revision">master</param>
|
<param name="revision">master</param>
|
||||||
</service>
|
</service>
|
||||||
<service name="extract_file">
|
<service name="extract_file">
|
||||||
|
|
2
dist/rpm/valentina.spec
vendored
2
dist/rpm/valentina.spec
vendored
|
@ -95,7 +95,7 @@ Requires: poppler-tools
|
||||||
Requires: poppler-utils
|
Requires: poppler-utils
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
Version: 0.7.46
|
Version: 0.7.47
|
||||||
Release: 0
|
Release: 0
|
||||||
URL: https://gitlab.com/smart-pattern/valentina
|
URL: https://gitlab.com/smart-pattern/valentina
|
||||||
License: GPL-3.0+
|
License: GPL-3.0+
|
||||||
|
|
11
dist/valentina.dsc
vendored
11
dist/valentina.dsc
vendored
|
@ -2,7 +2,7 @@ Format: 3.0 (native)
|
||||||
Source: valentina
|
Source: valentina
|
||||||
Binary: valentina
|
Binary: valentina
|
||||||
Architecture: i386 amd64
|
Architecture: i386 amd64
|
||||||
Version: 0.7.46
|
Version: 0.7.47
|
||||||
Maintainer: Roman Telezhynskyi <dismine@gmail.com>
|
Maintainer: Roman Telezhynskyi <dismine@gmail.com>
|
||||||
Homepage: https://valentinaproject.bitbucket.io
|
Homepage: https://valentinaproject.bitbucket.io
|
||||||
Standards-Version: 3.9.5
|
Standards-Version: 3.9.5
|
||||||
|
@ -11,15 +11,12 @@ Build-Depends: debhelper (>= 8.0.0),
|
||||||
qtbase5-dev (>= 5.4.0),
|
qtbase5-dev (>= 5.4.0),
|
||||||
libqt5svg5-dev (>= 5.4.0),
|
libqt5svg5-dev (>= 5.4.0),
|
||||||
g++ (>= 4.8.0),
|
g++ (>= 4.8.0),
|
||||||
qt5-default (>= 5.4.0),
|
|
||||||
qttools5-dev-tools (>= 5.4.0),
|
qttools5-dev-tools (>= 5.4.0),
|
||||||
libqt5xmlpatterns5-dev (>= 5.4.0),
|
libqt5xmlpatterns5-dev (>= 5.4.0),
|
||||||
libqt5opengl5-dev (>= 5.4.0)
|
libqt5opengl5-dev (>= 5.4.0)
|
||||||
|
Debtransform-Tar: valentina-0.7.47.v0.7.47.tar.gz
|
||||||
Package-List:
|
Package-List:
|
||||||
valentina deb graphics optional
|
valentina deb graphics optional
|
||||||
Checksums-Sha1:
|
|
||||||
581eb1bf36b4ab7126b5983d809130f15396859e 24838101 valentina_0.7.46.tar
|
|
||||||
Checksums-Sha256:
|
|
||||||
9b156c7120a69b90373efb8ca9998c3e0563a60ad337210166cfd41b00b0f13c 24838101 valentina_0.7.46.tar
|
|
||||||
Files:
|
Files:
|
||||||
95677e29d3a59cf5b064f7be236a4b78 24838101 valentina_0.7.46.tar
|
00000000000000000000000000000000 0 valentina-0.7.47.v0.7.47.tar.gz
|
||||||
|
|
||||||
|
|
|
@ -17,3 +17,5 @@ do
|
||||||
basename=${file##*/} # remove the path from a path-string
|
basename=${file##*/} # remove the path from a path-string
|
||||||
cp -v -f $file $OBSDEBIAN/debian.${basename}
|
cp -v -f $file $OBSDEBIAN/debian.${basename}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
cp -v -f ../dist/valentina.dsc $OBSDEBIAN/valentina.dsc
|
||||||
|
|
|
@ -24,9 +24,9 @@ if [[ "$DEPLOY" == "true" ]]; then
|
||||||
check_failure "Unable to patch the app bundle.";
|
check_failure "Unable to patch the app bundle.";
|
||||||
|
|
||||||
if [[ "$LEGACY" = false ]]; then
|
if [[ "$LEGACY" = false ]]; then
|
||||||
legacy_suffix = ""
|
legacy_suffix=""
|
||||||
else
|
else
|
||||||
legacy_suffix = "-legacy"
|
legacy_suffix="-legacy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_info "Start compressing.";
|
print_info "Start compressing.";
|
||||||
|
|
|
@ -332,7 +332,7 @@ bool TMainWindow::LoadFile(const QString &path)
|
||||||
throw VException(tr("File contains invalid known measurement(s)."));
|
throw VException(tr("File contains invalid known measurement(s)."));
|
||||||
}
|
}
|
||||||
|
|
||||||
mUnit = m->MUnit();
|
mUnit = m->Units();
|
||||||
pUnit = mUnit;
|
pUnit = mUnit;
|
||||||
|
|
||||||
currentDimensionA = m->DimensionABase();
|
currentDimensionA = m->DimensionABase();
|
||||||
|
@ -2672,7 +2672,7 @@ void TMainWindow::InitMenu()
|
||||||
void TMainWindow::InitDimensionsBaseValue()
|
void TMainWindow::InitDimensionsBaseValue()
|
||||||
{
|
{
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
const QString unit = UnitsToStr(m->Units(), true);
|
||||||
const bool fc = m->IsFullCircumference();
|
const bool fc = m->IsFullCircumference();
|
||||||
|
|
||||||
auto DimensionsBaseValue = [this, dimensions, unit, fc](int index, QLabel *name, QLabel *base)
|
auto DimensionsBaseValue = [this, dimensions, unit, fc](int index, QLabel *name, QLabel *base)
|
||||||
|
@ -2726,7 +2726,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
SCASSERT(control != nullptr)
|
SCASSERT(control != nullptr)
|
||||||
|
|
||||||
const bool fc = m->IsFullCircumference();
|
const bool fc = m->IsFullCircumference();
|
||||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
const QString unit = UnitsToStr(m->Units(), true);
|
||||||
|
|
||||||
qreal current = -1;
|
qreal current = -1;
|
||||||
if (control->currentIndex() != -1)
|
if (control->currentIndex() != -1)
|
||||||
|
@ -2811,7 +2811,7 @@ void TMainWindow::InitDimensionGradation(int index, const MeasurementDimension_p
|
||||||
void TMainWindow::InitDimensionControls()
|
void TMainWindow::InitDimensionControls()
|
||||||
{
|
{
|
||||||
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
const QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
const QString unit = UnitsToStr(m->MUnit(), true);
|
const QString unit = UnitsToStr(m->Units(), true);
|
||||||
|
|
||||||
auto InitControl = [this, dimensions, unit](int index, QLabel *&name, QComboBox *&control)
|
auto InitControl = [this, dimensions, unit](int index, QLabel *&name, QComboBox *&control)
|
||||||
{
|
{
|
||||||
|
@ -3574,7 +3574,7 @@ bool TMainWindow::LoadFromExistingFile(const QString &path)
|
||||||
throw VException(tr("File contains invalid known measurement(s)."));
|
throw VException(tr("File contains invalid known measurement(s)."));
|
||||||
}
|
}
|
||||||
|
|
||||||
mUnit = m->MUnit();
|
mUnit = m->Units();
|
||||||
pUnit = mUnit;
|
pUnit = mUnit;
|
||||||
|
|
||||||
currentDimensionA = m->DimensionABase();
|
currentDimensionA = m->DimensionABase();
|
||||||
|
@ -4358,7 +4358,7 @@ void TMainWindow::InitMeasurementUnits()
|
||||||
}
|
}
|
||||||
|
|
||||||
QString units;
|
QString units;
|
||||||
switch (m->MUnit())
|
switch (m->Units())
|
||||||
{
|
{
|
||||||
case Unit::Mm:
|
case Unit::Mm:
|
||||||
units = tr("Millimeters");
|
units = tr("Millimeters");
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
|
#include <QCompleter>
|
||||||
|
|
||||||
#include "../xml/vpattern.h"
|
#include "../xml/vpattern.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
@ -42,22 +43,14 @@
|
||||||
#include "../vtools/dialogs/support/dialogeditlabel.h"
|
#include "../vtools/dialogs/support/dialogeditlabel.h"
|
||||||
#include "dialogknownmaterials.h"
|
#include "dialogknownmaterials.h"
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
#include "../qmuparser/qmudef.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent)
|
DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogPatternProperties),
|
ui(new Ui::DialogPatternProperties),
|
||||||
doc(doc),
|
doc(doc),
|
||||||
pattern(pattern),
|
pattern(pattern)
|
||||||
data(QMap<QCheckBox *, int>()),
|
|
||||||
descriptionChanged(false),
|
|
||||||
gradationChanged(false),
|
|
||||||
defaultChanged(false),
|
|
||||||
securityChanged(false),
|
|
||||||
deleteAction(nullptr),
|
|
||||||
changeImageAction(nullptr),
|
|
||||||
saveImageAction(nullptr),
|
|
||||||
showImageAction(nullptr)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -137,8 +130,27 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
|
||||||
ui->checkBoxPatternReadOnly->setDisabled(true);
|
ui->checkBoxPatternReadOnly->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------- Passmark length
|
||||||
|
m_variables = pattern->DataMeasurements().keys() + pattern->DataIncrements().keys();
|
||||||
|
m_completer = new QCompleter(m_variables, this);
|
||||||
|
m_completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||||
|
m_completer->setModelSorting(QCompleter::UnsortedModel);
|
||||||
|
m_completer->setFilterMode(Qt::MatchContains);
|
||||||
|
m_completer->setCaseSensitivity(Qt::CaseSensitive);
|
||||||
|
|
||||||
|
ui->lineEditPassmarkLength->setCompleter(m_completer);
|
||||||
|
connect(ui->lineEditPassmarkLength, &QLineEdit::textEdited, this, [this]()
|
||||||
|
{
|
||||||
|
ValidatePassmarkLength();
|
||||||
|
DescEdited();
|
||||||
|
});
|
||||||
|
|
||||||
|
ui->lineEditPassmarkLength->installEventFilter(this);
|
||||||
|
m_oldPassmarkLength = doc->GetPassmarkLengthVariable();
|
||||||
|
ui->lineEditPassmarkLength->setText(m_oldPassmarkLength);
|
||||||
|
ValidatePassmarkLength();
|
||||||
|
|
||||||
//Initialization change value. Set to default value after initialization
|
//Initialization change value. Set to default value after initialization
|
||||||
gradationChanged = false;
|
|
||||||
defaultChanged = false;
|
defaultChanged = false;
|
||||||
securityChanged = false;
|
securityChanged = false;
|
||||||
}
|
}
|
||||||
|
@ -149,6 +161,27 @@ DialogPatternProperties::~DialogPatternProperties()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto DialogPatternProperties::eventFilter(QObject *object, QEvent *event) -> bool
|
||||||
|
{
|
||||||
|
if (ui->lineEditPassmarkLength == qobject_cast<QLineEdit *>(object))
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::KeyPress)
|
||||||
|
{
|
||||||
|
auto *keyEvent = static_cast<QKeyEvent *>(event);
|
||||||
|
if ((keyEvent->key() == Qt::Key_Space) && ((keyEvent->modifiers() & Qt::ControlModifier) != 0U))
|
||||||
|
{
|
||||||
|
m_completer->complete();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QDialog::eventFilter(object, event);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::Apply()
|
void DialogPatternProperties::Apply()
|
||||||
{
|
{
|
||||||
|
@ -188,8 +221,16 @@ void DialogPatternProperties::SaveDescription()
|
||||||
doc->SetNotes(ui->plainTextEditTechNotes->document()->toPlainText());
|
doc->SetNotes(ui->plainTextEditTechNotes->document()->toPlainText());
|
||||||
doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
doc->SetDescription(ui->plainTextEditDescription->document()->toPlainText());
|
||||||
doc->SetLabelPrefix(qvariant_cast<QString>(ui->comboBoxLabelLanguage->currentData()));
|
doc->SetLabelPrefix(qvariant_cast<QString>(ui->comboBoxLabelLanguage->currentData()));
|
||||||
|
doc->SetPassmarkLengthVariable(ui->lineEditPassmarkLength->text());
|
||||||
|
|
||||||
|
if (m_oldPassmarkLength != ui->lineEditPassmarkLength->text())
|
||||||
|
{
|
||||||
|
emit UpddatePieces();
|
||||||
|
m_oldPassmarkLength = ui->lineEditPassmarkLength->text();
|
||||||
|
}
|
||||||
|
|
||||||
descriptionChanged = false;
|
descriptionChanged = false;
|
||||||
|
emit doc->patternChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,6 +260,27 @@ QImage DialogPatternProperties::GetImage()
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPatternProperties::ValidatePassmarkLength() const
|
||||||
|
{
|
||||||
|
const QString text = ui->lineEditPassmarkLength->text();
|
||||||
|
QPalette palette = ui->lineEditPassmarkLength->palette();
|
||||||
|
const QPalette::ColorRole foregroundRole = ui->lineEditPassmarkLength->foregroundRole();
|
||||||
|
|
||||||
|
QRegularExpression rx(NameRegExp());
|
||||||
|
if (not text.isEmpty())
|
||||||
|
{
|
||||||
|
palette.setColor(foregroundRole,
|
||||||
|
rx.match(text).hasMatch() && m_variables.contains(text) ? Qt::black : Qt::red);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
palette.setColor(foregroundRole, Qt::black);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->lineEditPassmarkLength->setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPatternProperties::InitImage()
|
void DialogPatternProperties::InitImage()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
class VPattern;
|
class VPattern;
|
||||||
class VContainer;
|
class VContainer;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
|
class QCompleter;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -50,6 +51,10 @@ class DialogPatternProperties : public QDialog
|
||||||
public:
|
public:
|
||||||
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
|
||||||
virtual ~DialogPatternProperties() override;
|
virtual ~DialogPatternProperties() override;
|
||||||
|
signals:
|
||||||
|
void UpddatePieces();
|
||||||
|
protected:
|
||||||
|
virtual bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
void Apply();
|
void Apply();
|
||||||
void Ok();
|
void Ok();
|
||||||
|
@ -61,21 +66,25 @@ private:
|
||||||
Ui::DialogPatternProperties *ui;
|
Ui::DialogPatternProperties *ui;
|
||||||
VPattern *doc;
|
VPattern *doc;
|
||||||
VContainer *pattern;
|
VContainer *pattern;
|
||||||
QMap<QCheckBox *, int> data;
|
QMap<QCheckBox *, int> data{};
|
||||||
bool descriptionChanged;
|
bool descriptionChanged{false};
|
||||||
bool gradationChanged;
|
bool defaultChanged{false};
|
||||||
bool defaultChanged;
|
bool securityChanged{false};
|
||||||
bool securityChanged;
|
QAction *deleteAction{nullptr};
|
||||||
QAction *deleteAction;
|
QAction *changeImageAction{nullptr};
|
||||||
QAction *changeImageAction;
|
QAction *saveImageAction{nullptr};
|
||||||
QAction *saveImageAction;
|
QAction *showImageAction{nullptr};
|
||||||
QAction *showImageAction;
|
QCompleter *m_completer{nullptr};
|
||||||
|
QStringList m_variables{};
|
||||||
|
QString m_oldPassmarkLength{};
|
||||||
|
|
||||||
void SaveDescription();
|
void SaveDescription();
|
||||||
void SaveReadOnlyState();
|
void SaveReadOnlyState();
|
||||||
|
|
||||||
void InitImage();
|
void InitImage();
|
||||||
QImage GetImage();
|
QImage GetImage();
|
||||||
|
|
||||||
|
void ValidatePassmarkLength() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGPATTERNPROPERTIES_H
|
#endif // DIALOGPATTERNPROPERTIES_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>571</width>
|
<width>493</width>
|
||||||
<height>491</height>
|
<height>582</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -81,8 +81,11 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item>
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_12">
|
<widget class="QLabel" name="label_12">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||||
|
@ -95,7 +98,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxLabelLanguage">
|
<widget class="QComboBox" name="comboBoxLabelLanguage">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
@ -105,18 +108,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QLabel" name="label">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>Passmark length:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</item>
|
||||||
<width>40</width>
|
<item row="1" column="1">
|
||||||
<height>20</height>
|
<widget class="QLineEdit" name="lineEditPassmarkLength">
|
||||||
</size>
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -2065,7 +2065,7 @@ void MainWindow::CleanWaterkmarkEditors()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::StoreMultisizeMDimensions()
|
void MainWindow::StoreMultisizeMDimensions()
|
||||||
{
|
{
|
||||||
VAbstractValApplication::VApp()->SetMeasurementsUnits(m->MUnit());
|
VAbstractValApplication::VApp()->SetMeasurementsUnits(m->Units());
|
||||||
|
|
||||||
QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
QList<MeasurementDimension_p> dimensions = m->Dimensions().values();
|
||||||
|
|
||||||
|
@ -2091,7 +2091,7 @@ void MainWindow::StoreMultisizeMDimensions()
|
||||||
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
labels.value(currentBase, QString::number(fc ? currentBase*2 : currentBase)));
|
||||||
const bool circumference = dimension->IsCircumference();
|
const bool circumference = dimension->IsCircumference();
|
||||||
VAbstractValApplication::VApp()
|
VAbstractValApplication::VApp()
|
||||||
->SetDimensionSizeUnits(circumference ? m->MUnit() : Unit::LAST_UNIT_DO_NOT_USE);
|
->SetDimensionSizeUnits(circumference ? m->Units() : Unit::LAST_UNIT_DO_NOT_USE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MeasurementDimension::W:
|
case MeasurementDimension::W:
|
||||||
|
@ -5078,6 +5078,8 @@ void MainWindow::CreateActions()
|
||||||
connect(ui->actionPattern_properties, &QAction::triggered, this, [this]()
|
connect(ui->actionPattern_properties, &QAction::triggered, this, [this]()
|
||||||
{
|
{
|
||||||
DialogPatternProperties proper(doc, pattern, this);
|
DialogPatternProperties proper(doc, pattern, this);
|
||||||
|
connect(&proper, &DialogPatternProperties::UpddatePieces, sceneDetails,
|
||||||
|
&VMainGraphicsScene::UpdatePiecePassmarks);
|
||||||
proper.exec();
|
proper.exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5352,7 +5354,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
|
||||||
{
|
{
|
||||||
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
|
doc->SetMPath(RelativeMPath(fileName, customMeasureFile));
|
||||||
}
|
}
|
||||||
VAbstractValApplication::VApp()->SetPatternUnits(doc->MUnit());
|
VAbstractValApplication::VApp()->SetPatternUnits(doc->Units());
|
||||||
|
|
||||||
QString path = AbsoluteMPath(fileName, doc->MPath());
|
QString path = AbsoluteMPath(fileName, doc->MPath());
|
||||||
QString fixedMPath;
|
QString fixedMPath;
|
||||||
|
@ -5439,7 +5441,7 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
|
||||||
{
|
{
|
||||||
doc->SetMPath(RelativeMPath(fileName, fixedMPath));
|
doc->SetMPath(RelativeMPath(fileName, fixedMPath));
|
||||||
}
|
}
|
||||||
VAbstractValApplication::VApp()->SetPatternUnits(doc->MUnit());
|
VAbstractValApplication::VApp()->SetPatternUnits(doc->Units());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (VException &e)
|
catch (VException &e)
|
||||||
|
|
|
@ -141,6 +141,9 @@ void VPattern::CreateEmptyFile()
|
||||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
||||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
||||||
this->firstChild());
|
this->firstChild());
|
||||||
|
|
||||||
|
// Cache values
|
||||||
|
m_units = VAbstractValApplication::VApp()->patternUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2280,6 +2283,8 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
|
||||||
initData.curveId = GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
initData.curveId = GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
||||||
initData.formulaAngle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0"));
|
initData.formulaAngle = GetParametrString(domElement, AttrAngle, QStringLiteral("0.0"));
|
||||||
const QString angleFix = initData.formulaAngle;
|
const QString angleFix = initData.formulaAngle;
|
||||||
|
initData.aliasSuffix1 = GetParametrEmptyString(domElement, AttrAlias1);
|
||||||
|
initData.aliasSuffix2 = GetParametrEmptyString(domElement, AttrAlias2);
|
||||||
|
|
||||||
VToolCurveIntersectAxis::Create(initData);
|
VToolCurveIntersectAxis::Create(initData);
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
|
@ -2401,6 +2406,10 @@ void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDo
|
||||||
initData.secondCurveId = GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
|
initData.secondCurveId = GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
|
||||||
initData.vCrossPoint = static_cast<VCrossCurvesPoint>(GetParametrUInt(domElement, AttrVCrossPoint, QChar('1')));
|
initData.vCrossPoint = static_cast<VCrossCurvesPoint>(GetParametrUInt(domElement, AttrVCrossPoint, QChar('1')));
|
||||||
initData.hCrossPoint = static_cast<HCrossCurvesPoint>(GetParametrUInt(domElement, AttrHCrossPoint, QChar('1')));
|
initData.hCrossPoint = static_cast<HCrossCurvesPoint>(GetParametrUInt(domElement, AttrHCrossPoint, QChar('1')));
|
||||||
|
initData.curve1AliasSuffix1 = GetParametrEmptyString(domElement, AttrCurve1Alias1);
|
||||||
|
initData.curve1AliasSuffix2 = GetParametrEmptyString(domElement, AttrCurve1Alias2);
|
||||||
|
initData.curve2AliasSuffix1 = GetParametrEmptyString(domElement, AttrCurve2Alias1);
|
||||||
|
initData.curve2AliasSuffix2 = GetParametrEmptyString(domElement, AttrCurve2Alias2);
|
||||||
|
|
||||||
VToolPointOfIntersectionCurves::Create(initData);
|
VToolPointOfIntersectionCurves::Create(initData);
|
||||||
}
|
}
|
||||||
|
@ -3692,21 +3701,21 @@ void VPattern::RefreshPieceGeometry()
|
||||||
VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
|
VMainGraphicsView::NewSceneRect(sceneDetail, VAbstractValApplication::VApp()->getSceneView());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (VApplication::VApp()->IsGUIMode() && m_parsing)
|
if (VApplication::IsGUIMode() && m_parsing)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto pieceId : qAsConst(updatePieces))
|
for(auto pieceId : qAsConst(updatePieces))
|
||||||
{
|
{
|
||||||
if (VApplication::VApp()->IsGUIMode() && m_parsing)
|
if (VApplication::IsGUIMode() && m_parsing)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (VToolSeamAllowance *piece = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(pieceId)))
|
if (auto *piece = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(pieceId)))
|
||||||
{
|
{
|
||||||
piece->RefreshGeometry();
|
piece->RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
@ -3718,7 +3727,7 @@ void VPattern::RefreshPieceGeometry()
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
if (VApplication::VApp()->IsGUIMode() && m_parsing)
|
if (VApplication::IsGUIMode() && m_parsing)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,12 +119,11 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
virtual void LiteParseTree(const Document &parse) override;
|
virtual void LiteParseTree(const Document &parse) override;
|
||||||
|
|
||||||
|
void RefreshPieceGeometry();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void customEvent(QEvent * event) override;
|
virtual void customEvent(QEvent * event) override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void RefreshPieceGeometry();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPattern)
|
Q_DISABLE_COPY(VPattern)
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,10 @@ const QString AttrNotes = QStringLiteral("notes");
|
||||||
const QString AttrAlias = QStringLiteral("alias");
|
const QString AttrAlias = QStringLiteral("alias");
|
||||||
const QString AttrAlias1 = QStringLiteral("alias1");
|
const QString AttrAlias1 = QStringLiteral("alias1");
|
||||||
const QString AttrAlias2 = QStringLiteral("alias2");
|
const QString AttrAlias2 = QStringLiteral("alias2");
|
||||||
|
const QString AttrCurve1Alias1 = QStringLiteral("curve1Alias1");
|
||||||
|
const QString AttrCurve1Alias2 = QStringLiteral("curve1Alias2");
|
||||||
|
const QString AttrCurve2Alias1 = QStringLiteral("curve2Alias1");
|
||||||
|
const QString AttrCurve2Alias2 = QStringLiteral("curve2Alias2");
|
||||||
|
|
||||||
const QString TypeLineDefault = QStringLiteral("default");
|
const QString TypeLineDefault = QStringLiteral("default");
|
||||||
const QString TypeLineNone = QStringLiteral("none");
|
const QString TypeLineNone = QStringLiteral("none");
|
||||||
|
|
|
@ -156,6 +156,10 @@ extern const QString AttrNotes;
|
||||||
extern const QString AttrAlias;
|
extern const QString AttrAlias;
|
||||||
extern const QString AttrAlias1;
|
extern const QString AttrAlias1;
|
||||||
extern const QString AttrAlias2;
|
extern const QString AttrAlias2;
|
||||||
|
extern const QString AttrCurve1Alias1;
|
||||||
|
extern const QString AttrCurve1Alias2;
|
||||||
|
extern const QString AttrCurve2Alias1;
|
||||||
|
extern const QString AttrCurve2Alias2;
|
||||||
|
|
||||||
extern const QString TypeLineDefault;
|
extern const QString TypeLineDefault;
|
||||||
extern const QString TypeLineNone;
|
extern const QString TypeLineNone;
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<file>schema/pattern/v0.8.8.xsd</file>
|
<file>schema/pattern/v0.8.8.xsd</file>
|
||||||
<file>schema/pattern/v0.8.9.xsd</file>
|
<file>schema/pattern/v0.8.9.xsd</file>
|
||||||
<file>schema/pattern/v0.8.10.xsd</file>
|
<file>schema/pattern/v0.8.10.xsd</file>
|
||||||
|
<file>schema/pattern/v0.8.11.xsd</file>
|
||||||
<file>schema/multisize_measurements/v0.3.0.xsd</file>
|
<file>schema/multisize_measurements/v0.3.0.xsd</file>
|
||||||
<file>schema/multisize_measurements/v0.4.0.xsd</file>
|
<file>schema/multisize_measurements/v0.4.0.xsd</file>
|
||||||
<file>schema/multisize_measurements/v0.4.1.xsd</file>
|
<file>schema/multisize_measurements/v0.4.1.xsd</file>
|
||||||
|
|
1127
src/libs/ifc/schema/pattern/v0.8.11.xsd
Normal file
1127
src/libs/ifc/schema/pattern/v0.8.11.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,19 @@ VAbstractMConverter::VAbstractMConverter(const QString &fileName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractMConverter::Units() const -> Unit
|
||||||
|
{
|
||||||
|
Unit units = StrToUnits(UniqueTagText(TagUnit, unitCM));
|
||||||
|
|
||||||
|
if (units == Unit::Px)
|
||||||
|
{
|
||||||
|
units = Unit::Cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractMConverter::AddRootComment()
|
void VAbstractMConverter::AddRootComment()
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,6 +43,8 @@ public:
|
||||||
explicit VAbstractMConverter(const QString &fileName);
|
explicit VAbstractMConverter(const QString &fileName);
|
||||||
virtual ~VAbstractMConverter() Q_DECL_EQ_DEFAULT;
|
virtual ~VAbstractMConverter() Q_DECL_EQ_DEFAULT;
|
||||||
|
|
||||||
|
auto Units() const -> Unit;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddRootComment();
|
void AddRootComment();
|
||||||
static QMultiMap<QString, QString> OldNamesToNewNames_InV0_3_0();
|
static QMultiMap<QString, QString> OldNamesToNewNames_InV0_3_0();
|
||||||
|
|
|
@ -155,14 +155,6 @@ bool VAbstractPattern::patternLabelWasChanged = false;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Need to be reinited in setXMLContent as well
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, patternNumberCached, (unknownCharacter))
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, labelDateFormatCached, (unknownCharacter))
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, patternNameCached, (unknownCharacter))
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, MPathCached, (unknownCharacter))
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, WatermarkPathCached, (unknownCharacter))
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(QString, companyNameCached, (unknownCharacter))
|
|
||||||
|
|
||||||
void ReadExpressionAttribute(QVector<VFormulaField> &expressions, const QDomElement &element, const QString &attribute)
|
void ReadExpressionAttribute(QVector<VFormulaField> &expressions, const QDomElement &element, const QString &attribute)
|
||||||
{
|
{
|
||||||
VFormulaField formula;
|
VFormulaField formula;
|
||||||
|
@ -592,17 +584,26 @@ void VAbstractPattern::setXMLContent(const QString &fileName)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
VDomDocument::setXMLContent(fileName);
|
VDomDocument::setXMLContent(fileName);
|
||||||
|
m_patternNumber = ReadPatternNumber();
|
||||||
|
m_labelDateFormat = ReadLabelDateFormat();
|
||||||
|
m_patternName = ReadPatternName();
|
||||||
|
m_MPath = ReadMPath();
|
||||||
|
m_watermarkPath = ReadWatermarkPath();
|
||||||
|
m_companyName = ReadCompanyName();
|
||||||
|
m_units = ReadUnits();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::Clear()
|
void VAbstractPattern::Clear()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
*patternNumberCached = unknownCharacter;
|
m_patternNumber.clear();
|
||||||
*labelDateFormatCached = unknownCharacter;
|
m_labelDateFormat.clear();
|
||||||
*patternNameCached = unknownCharacter;
|
m_patternName.clear();
|
||||||
*MPathCached = unknownCharacter;
|
m_MPath.clear();
|
||||||
*companyNameCached = unknownCharacter;
|
m_watermarkPath.clear();
|
||||||
|
m_companyName.clear();
|
||||||
|
m_units = Unit::LAST_UNIT_DO_NOT_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -820,11 +821,7 @@ QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::MPath() const
|
QString VAbstractPattern::MPath() const
|
||||||
{
|
{
|
||||||
if (*MPathCached == unknownCharacter)
|
return m_MPath;
|
||||||
{
|
|
||||||
*MPathCached = UniqueTagText(TagMeasurements);
|
|
||||||
}
|
|
||||||
return *MPathCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -832,9 +829,10 @@ void VAbstractPattern::SetMPath(const QString &path)
|
||||||
{
|
{
|
||||||
if (setTagText(TagMeasurements, path))
|
if (setTagText(TagMeasurements, path))
|
||||||
{
|
{
|
||||||
emit patternChanged(false);
|
m_MPath = path;
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
*MPathCached = path;
|
modified = true;
|
||||||
|
emit patternChanged(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -932,19 +930,15 @@ void VAbstractPattern::SetNotes(const QString &text)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetPatternName() const
|
QString VAbstractPattern::GetPatternName() const
|
||||||
{
|
{
|
||||||
if (*patternNameCached == unknownCharacter)
|
return m_patternName;
|
||||||
{
|
|
||||||
*patternNameCached = UniqueTagText(TagPatternName);
|
|
||||||
}
|
|
||||||
return *patternNameCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::SetPatternName(const QString &qsName)
|
void VAbstractPattern::SetPatternName(const QString &qsName)
|
||||||
{
|
{
|
||||||
*patternNameCached = qsName;
|
m_patternName = qsName;
|
||||||
CheckTagExists(TagPatternName);
|
CheckTagExists(TagPatternName);
|
||||||
setTagText(TagPatternName, *patternNameCached);
|
setTagText(TagPatternName, m_patternName);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
modified = true;
|
modified = true;
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
|
@ -953,19 +947,15 @@ void VAbstractPattern::SetPatternName(const QString &qsName)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetCompanyName() const
|
QString VAbstractPattern::GetCompanyName() const
|
||||||
{
|
{
|
||||||
if (*companyNameCached == unknownCharacter)
|
return m_companyName;
|
||||||
{
|
|
||||||
*companyNameCached = UniqueTagText(TagCompanyName);
|
|
||||||
}
|
|
||||||
return *companyNameCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::SetCompanyName(const QString& qsName)
|
void VAbstractPattern::SetCompanyName(const QString& qsName)
|
||||||
{
|
{
|
||||||
*companyNameCached = qsName;
|
m_companyName = qsName;
|
||||||
CheckTagExists(TagCompanyName);
|
CheckTagExists(TagCompanyName);
|
||||||
setTagText(TagCompanyName, *companyNameCached);
|
setTagText(TagCompanyName, m_companyName);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
modified = true;
|
modified = true;
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
|
@ -974,19 +964,15 @@ void VAbstractPattern::SetCompanyName(const QString& qsName)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetPatternNumber() const
|
QString VAbstractPattern::GetPatternNumber() const
|
||||||
{
|
{
|
||||||
if (*patternNumberCached == unknownCharacter)
|
return m_patternNumber;
|
||||||
{
|
|
||||||
*patternNumberCached = UniqueTagText(TagPatternNum);
|
|
||||||
}
|
|
||||||
return *patternNumberCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::SetPatternNumber(const QString& qsNum)
|
void VAbstractPattern::SetPatternNumber(const QString& qsNum)
|
||||||
{
|
{
|
||||||
*patternNumberCached = qsNum;
|
m_patternNumber = qsNum;
|
||||||
CheckTagExists(TagPatternNum);
|
CheckTagExists(TagPatternNum);
|
||||||
setTagText(TagPatternNum, *patternNumberCached);
|
setTagText(TagPatternNum, m_patternNumber);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
modified = true;
|
modified = true;
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
|
@ -1043,34 +1029,15 @@ void VAbstractPattern::SetCustomerEmail(const QString &email)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetLabelDateFormat() const
|
QString VAbstractPattern::GetLabelDateFormat() const
|
||||||
{
|
{
|
||||||
if (*labelDateFormatCached == unknownCharacter)
|
return m_labelDateFormat;
|
||||||
{
|
|
||||||
const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
|
|
||||||
|
|
||||||
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
|
||||||
if (list.isEmpty())
|
|
||||||
{
|
|
||||||
return globalLabelDateFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
*labelDateFormatCached = GetParametrString(list.at(0).toElement(), AttrDateFormat);
|
|
||||||
}
|
|
||||||
catch (const VExceptionEmptyParameter &)
|
|
||||||
{
|
|
||||||
return globalLabelDateFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *labelDateFormatCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::SetLabelDateFormat(const QString &format)
|
void VAbstractPattern::SetLabelDateFormat(const QString &format)
|
||||||
{
|
{
|
||||||
*labelDateFormatCached = format;
|
m_labelDateFormat = format;
|
||||||
QDomElement tag = CheckTagExists(TagPatternLabel);
|
QDomElement tag = CheckTagExists(TagPatternLabel);
|
||||||
SetAttribute(tag, AttrDateFormat, *labelDateFormatCached);
|
SetAttribute(tag, AttrDateFormat, m_labelDateFormat);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
modified = true;
|
modified = true;
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
|
@ -1142,7 +1109,8 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
|
||||||
|
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
*WatermarkPathCached = path;
|
m_watermarkPath = path;
|
||||||
|
modified = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1151,7 +1119,8 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
|
||||||
{
|
{
|
||||||
emit patternChanged(false);
|
emit patternChanged(false);
|
||||||
patternLabelWasChanged = true;
|
patternLabelWasChanged = true;
|
||||||
*WatermarkPathCached = path;
|
m_watermarkPath = path;
|
||||||
|
modified = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1165,11 +1134,7 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetWatermarkPath() const
|
QString VAbstractPattern::GetWatermarkPath() const
|
||||||
{
|
{
|
||||||
if (*WatermarkPathCached == unknownCharacter)
|
return m_watermarkPath;
|
||||||
{
|
|
||||||
*WatermarkPathCached = UniqueTagText(TagWatermark);
|
|
||||||
}
|
|
||||||
return *WatermarkPathCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1235,6 +1200,31 @@ bool VAbstractPattern::GetPatternWasChanged() const
|
||||||
return patternLabelWasChanged;
|
return patternLabelWasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::GetPassmarkLengthVariable() const
|
||||||
|
{
|
||||||
|
const QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
if (pattern.isNull())
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetParametrEmptyString(pattern, AttrPassmarkLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SetPassmarkLengthVariable(const QString &name)
|
||||||
|
{
|
||||||
|
QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
if (not pattern.isNull())
|
||||||
|
{
|
||||||
|
SetAttribute(pattern, AttrPassmarkLength, name);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetImage() const
|
QString VAbstractPattern::GetImage() const
|
||||||
{
|
{
|
||||||
|
@ -2277,6 +2267,73 @@ bool VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VAbstractPattern::ReadUnits() const -> Unit
|
||||||
|
{
|
||||||
|
Unit units = StrToUnits(UniqueTagText(TagUnit, unitCM));
|
||||||
|
|
||||||
|
if (units == Unit::Px)
|
||||||
|
{
|
||||||
|
units = Unit::Cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadPatternNumber() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagPatternNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadLabelDateFormat() const
|
||||||
|
{
|
||||||
|
const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
|
||||||
|
|
||||||
|
const QDomNodeList list = elementsByTagName(TagPatternLabel);
|
||||||
|
if (list.isEmpty())
|
||||||
|
{
|
||||||
|
return globalLabelDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString labelDateFormat;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
labelDateFormat = GetParametrString(list.at(0).toElement(), AttrDateFormat);
|
||||||
|
}
|
||||||
|
catch (const VExceptionEmptyParameter &)
|
||||||
|
{
|
||||||
|
return globalLabelDateFormat;
|
||||||
|
}
|
||||||
|
return labelDateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadPatternName() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagPatternName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadMPath() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagMeasurements);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadWatermarkPath() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagWatermark);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VAbstractPattern::ReadCompanyName() const
|
||||||
|
{
|
||||||
|
return UniqueTagText(TagCompanyName);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Adds an item to the given group with the given toolId and objectId
|
* @brief Adds an item to the given group with the given toolId and objectId
|
||||||
|
@ -2455,6 +2512,12 @@ VContainer VAbstractPattern::GetCompletePPData(const QString &name) const
|
||||||
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
Unit VAbstractPattern::Units() const
|
||||||
|
{
|
||||||
|
return m_units;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::FilterGroupTags(const QString &tags)
|
QStringList VAbstractPattern::FilterGroupTags(const QString &tags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -192,6 +192,9 @@ public:
|
||||||
void SetPatternWasChanged(bool changed);
|
void SetPatternWasChanged(bool changed);
|
||||||
bool GetPatternWasChanged() const;
|
bool GetPatternWasChanged() const;
|
||||||
|
|
||||||
|
QString GetPassmarkLengthVariable() const;
|
||||||
|
void SetPassmarkLengthVariable(const QString &name);
|
||||||
|
|
||||||
QString GetImage() const;
|
QString GetImage() const;
|
||||||
QString GetImageExtension() const;
|
QString GetImageExtension() const;
|
||||||
void SetImage(const QString &text, const QString &extension);
|
void SetImage(const QString &text, const QString &extension);
|
||||||
|
@ -233,6 +236,8 @@ public:
|
||||||
virtual VContainer GetCompleteData() const;
|
virtual VContainer GetCompleteData() const;
|
||||||
virtual VContainer GetCompletePPData(const QString &name) const;
|
virtual VContainer GetCompletePPData(const QString &name) const;
|
||||||
|
|
||||||
|
auto Units() const -> Unit;
|
||||||
|
|
||||||
static const QString TagPattern;
|
static const QString TagPattern;
|
||||||
static const QString TagCalculation;
|
static const QString TagCalculation;
|
||||||
static const QString TagModeling;
|
static const QString TagModeling;
|
||||||
|
@ -396,6 +401,14 @@ protected:
|
||||||
/** @brief modified keep state of the document for cases that do not cover QUndoStack*/
|
/** @brief modified keep state of the document for cases that do not cover QUndoStack*/
|
||||||
mutable bool modified;
|
mutable bool modified;
|
||||||
|
|
||||||
|
Unit m_units{Unit::LAST_UNIT_DO_NOT_USE};
|
||||||
|
QString m_patternNumber{};
|
||||||
|
QString m_labelDateFormat{};
|
||||||
|
QString m_patternName{};
|
||||||
|
QString m_MPath{};
|
||||||
|
QString m_watermarkPath{};
|
||||||
|
QString m_companyName{};
|
||||||
|
|
||||||
/** @brief tools list with pointer on tools. */
|
/** @brief tools list with pointer on tools. */
|
||||||
static QHash<quint32, VDataTool*> tools;
|
static QHash<quint32, VDataTool*> tools;
|
||||||
/** @brief patternLabelLines list to speed up reading a template by many pieces. */
|
/** @brief patternLabelLines list to speed up reading a template by many pieces. */
|
||||||
|
@ -421,6 +434,15 @@ protected:
|
||||||
QVector<VToolRecord> getLocalHistory(const QString &draw) const;
|
QVector<VToolRecord> getLocalHistory(const QString &draw) const;
|
||||||
|
|
||||||
bool GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId);
|
bool GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId);
|
||||||
|
|
||||||
|
auto ReadUnits() const -> Unit;
|
||||||
|
auto ReadPatternNumber() const ->QString;
|
||||||
|
auto ReadLabelDateFormat() const ->QString;
|
||||||
|
auto ReadPatternName() const ->QString;
|
||||||
|
auto ReadMPath() const ->QString;
|
||||||
|
auto ReadWatermarkPath() const -> QString;
|
||||||
|
auto ReadCompanyName() const -> QString;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VAbstractPattern)
|
Q_DISABLE_COPY(VAbstractPattern)
|
||||||
|
|
||||||
|
|
|
@ -232,8 +232,6 @@ bool LessThen(const QDomNode &element1, const QDomNode &element2)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit mUnitCached = Unit::LAST_UNIT_DO_NOT_USE;
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(vXML, "v.xml")
|
Q_LOGGING_CATEGORY(vXML, "v.xml")
|
||||||
|
@ -636,22 +634,6 @@ quint32 VDomDocument::GetParametrId(const QDomElement &domElement)
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
Unit VDomDocument::MUnit() const
|
|
||||||
{
|
|
||||||
if (mUnitCached == Unit::LAST_UNIT_DO_NOT_USE)
|
|
||||||
{
|
|
||||||
mUnitCached = StrToUnits(UniqueTagText(TagUnit, unitCM));
|
|
||||||
|
|
||||||
if (mUnitCached == Unit::Px)
|
|
||||||
{
|
|
||||||
mUnitCached = Unit::Cm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return mUnitCached;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const
|
QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,8 +118,6 @@ public:
|
||||||
static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue);
|
static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue);
|
||||||
static quint32 GetParametrId(const QDomElement& domElement);
|
static quint32 GetParametrId(const QDomElement& domElement);
|
||||||
|
|
||||||
Unit MUnit() const;
|
|
||||||
|
|
||||||
virtual void setXMLContent(const QString &fileName);
|
virtual void setXMLContent(const QString &fileName);
|
||||||
static QString UnitsHelpString();
|
static QString UnitsHelpString();
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.10");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.11");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.10.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.11.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -242,7 +242,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 7), QStringLiteral("://schema/pattern/v0.8.7.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 7), QStringLiteral("://schema/pattern/v0.8.7.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 8), QStringLiteral("://schema/pattern/v0.8.8.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 8), QStringLiteral("://schema/pattern/v0.8.8.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 9), QStringLiteral("://schema/pattern/v0.8.9.xsd")),
|
std::make_pair(FORMAT_VERSION(0, 8, 9), QStringLiteral("://schema/pattern/v0.8.9.xsd")),
|
||||||
std::make_pair(FORMAT_VERSION(0, 8, 10), CurrentSchema)
|
std::make_pair(FORMAT_VERSION(0, 8, 10), QStringLiteral("://schema/pattern/v0.8.10.xsd")),
|
||||||
|
std::make_pair(FORMAT_VERSION(0, 8, 11), CurrentSchema)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schemas.contains(ver))
|
if (schemas.contains(ver))
|
||||||
|
@ -503,6 +504,10 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 10)));
|
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 10)));
|
||||||
Q_FALLTHROUGH();
|
Q_FALLTHROUGH();
|
||||||
case (FORMAT_VERSION(0, 8, 10)):
|
case (FORMAT_VERSION(0, 8, 10)):
|
||||||
|
ToV0_8_11();
|
||||||
|
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 11)));
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
case (FORMAT_VERSION(0, 8, 11)):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -520,7 +525,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VPatternConverter::IsReadOnly() const
|
bool VPatternConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 10),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 11),
|
||||||
"Check attribute readOnly.");
|
"Check attribute readOnly.");
|
||||||
|
|
||||||
// Possibly in future attribute readOnly will change position etc.
|
// Possibly in future attribute readOnly will change position etc.
|
||||||
|
@ -1192,6 +1197,16 @@ void VPatternConverter::ToV0_8_10()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_8_11()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.8.11
|
||||||
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 11),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
SetVersion(QStringLiteral("0.8.11"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
static const QString PatternMaxVerStr;
|
static const QString PatternMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 10);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 11);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const override;
|
virtual int MinVer() const override;
|
||||||
|
@ -133,6 +133,7 @@ private:
|
||||||
void ToV0_8_8();
|
void ToV0_8_8();
|
||||||
void ToV0_8_9();
|
void ToV0_8_9();
|
||||||
void ToV0_8_10();
|
void ToV0_8_10();
|
||||||
|
void ToV0_8_11();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -345,7 +345,7 @@ void VVSTConverter::AddNewTagsForV0_5_0()
|
||||||
return GetParametrInt(baseTag, QStringLiteral("base"), QChar('0'));
|
return GetParametrInt(baseTag, QStringLiteral("base"), QChar('0'));
|
||||||
};
|
};
|
||||||
|
|
||||||
const Unit units = MUnit();
|
const Unit units = Units();
|
||||||
|
|
||||||
{
|
{
|
||||||
const int step = static_cast<int>(UnitConvertor(6, Unit::Cm, units));
|
const int step = static_cast<int>(UnitConvertor(6, Unit::Cm, units));
|
||||||
|
|
|
@ -109,10 +109,7 @@ const QString VMeasurements::DimensionZ = QStringLiteral("z");
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using VDimensions = QMap<MeasurementDimension, MeasurementDimension_p>;
|
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, defBirthDate, (QLatin1String("1800-01-01")))
|
||||||
Q_GLOBAL_STATIC(VDimensions, dimensionsCached)
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FileComment()
|
QString FileComment()
|
||||||
|
@ -124,8 +121,7 @@ QString FileComment()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurements::VMeasurements(VContainer *data)
|
VMeasurements::VMeasurements(VContainer *data)
|
||||||
:VDomDocument(),
|
: data(data),
|
||||||
data(data),
|
|
||||||
type(MeasurementsType::Unknown)
|
type(MeasurementsType::Unknown)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
|
@ -133,8 +129,7 @@ VMeasurements::VMeasurements(VContainer *data)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
||||||
:VDomDocument(),
|
: data(data),
|
||||||
data(data),
|
|
||||||
type(MeasurementsType::Individual)
|
type(MeasurementsType::Individual)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
|
@ -145,8 +140,7 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VMeasurements::VMeasurements(Unit unit, const QVector<MeasurementDimension_p > &dimensions,
|
VMeasurements::VMeasurements(Unit unit, const QVector<MeasurementDimension_p > &dimensions,
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
:VDomDocument(),
|
: data(data),
|
||||||
data(data),
|
|
||||||
type(MeasurementsType::Multisize)
|
type(MeasurementsType::Multisize)
|
||||||
{
|
{
|
||||||
SCASSERT(data != nullptr)
|
SCASSERT(data != nullptr)
|
||||||
|
@ -159,6 +153,8 @@ void VMeasurements::setXMLContent(const QString &fileName)
|
||||||
{
|
{
|
||||||
VDomDocument::setXMLContent(fileName);
|
VDomDocument::setXMLContent(fileName);
|
||||||
type = ReadType();
|
type = ReadType();
|
||||||
|
m_units = ReadUnits();
|
||||||
|
m_dimensions = ReadDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -277,6 +273,12 @@ void VMeasurements::MoveBottom(const QString &name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VMeasurements::Units() const -> Unit
|
||||||
|
{
|
||||||
|
return m_units;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMeasurements::StoreNames(bool store)
|
void VMeasurements::StoreNames(bool store)
|
||||||
{
|
{
|
||||||
|
@ -327,25 +329,25 @@ void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) cons
|
||||||
|
|
||||||
if (not specialUnits)
|
if (not specialUnits)
|
||||||
{
|
{
|
||||||
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
|
base = UnitConvertor(base, Units(), *data->GetPatternUnit());
|
||||||
shiftA = UnitConvertor(shiftA, MUnit(), *data->GetPatternUnit());
|
shiftA = UnitConvertor(shiftA, Units(), *data->GetPatternUnit());
|
||||||
shiftB = UnitConvertor(shiftB, MUnit(), *data->GetPatternUnit());
|
shiftB = UnitConvertor(shiftB, Units(), *data->GetPatternUnit());
|
||||||
shiftC = UnitConvertor(shiftC, MUnit(), *data->GetPatternUnit());
|
shiftC = UnitConvertor(shiftC, Units(), *data->GetPatternUnit());
|
||||||
|
|
||||||
QMutableMapIterator<QString, qreal> iterator(corrections);
|
QMutableMapIterator<QString, qreal> iterator(corrections);
|
||||||
while (iterator.hasNext())
|
while (iterator.hasNext())
|
||||||
{
|
{
|
||||||
iterator.next();
|
iterator.next();
|
||||||
iterator.setValue(UnitConvertor(iterator.value(), MUnit(), *data->GetPatternUnit()));
|
iterator.setValue(UnitConvertor(iterator.value(), Units(), *data->GetPatternUnit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
convertedBaseA = UnitConvertor(convertedBaseA, MUnit(), *data->GetPatternUnit());
|
convertedBaseA = UnitConvertor(convertedBaseA, Units(), *data->GetPatternUnit());
|
||||||
convertedBaseB = UnitConvertor(convertedBaseB, MUnit(), *data->GetPatternUnit());
|
convertedBaseB = UnitConvertor(convertedBaseB, Units(), *data->GetPatternUnit());
|
||||||
convertedBaseC = UnitConvertor(convertedBaseC, MUnit(), *data->GetPatternUnit());
|
convertedBaseC = UnitConvertor(convertedBaseC, Units(), *data->GetPatternUnit());
|
||||||
|
|
||||||
convertedStepA = UnitConvertor(convertedStepA, MUnit(), *data->GetPatternUnit());
|
convertedStepA = UnitConvertor(convertedStepA, Units(), *data->GetPatternUnit());
|
||||||
convertedStepB = UnitConvertor(convertedStepB, MUnit(), *data->GetPatternUnit());
|
convertedStepB = UnitConvertor(convertedStepB, Units(), *data->GetPatternUnit());
|
||||||
convertedStepC = UnitConvertor(convertedStepC, MUnit(), *data->GetPatternUnit());
|
convertedStepC = UnitConvertor(convertedStepC, Units(), *data->GetPatternUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
meash = QSharedPointer<VMeasurement>::create(static_cast<quint32>(i), name,
|
meash = QSharedPointer<VMeasurement>::create(static_cast<quint32>(i), name,
|
||||||
|
@ -380,7 +382,7 @@ void VMeasurements::ReadMeasurements(qreal baseA, qreal baseB, qreal baseC) cons
|
||||||
|
|
||||||
if (not specialUnits)
|
if (not specialUnits)
|
||||||
{
|
{
|
||||||
value = UnitConvertor(value, MUnit(), *data->GetPatternUnit());
|
value = UnitConvertor(value, Units(), *data->GetPatternUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
meash = QSharedPointer<VMeasurement>::create(data, static_cast<quint32>(i), name, value, formula, ok);
|
meash = QSharedPointer<VMeasurement>::create(data, static_cast<quint32>(i), name, value, formula, ok);
|
||||||
|
@ -846,61 +848,9 @@ QString VMeasurements::MeasurementForDimension(IMD type) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VMeasurements::Dimensions() const -> QMap<MeasurementDimension, MeasurementDimension_p >
|
auto VMeasurements::Dimensions() const -> VDimensions
|
||||||
{
|
{
|
||||||
if (type != MeasurementsType::Multisize)
|
return m_dimensions;
|
||||||
{
|
|
||||||
return QMap<MeasurementDimension, MeasurementDimension_p>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dimensionsCached->isEmpty())
|
|
||||||
{
|
|
||||||
const Unit units = MUnit();
|
|
||||||
const QDomNodeList list = elementsByTagName(TagDimension);
|
|
||||||
for (int i=0; i < list.size(); ++i)
|
|
||||||
{
|
|
||||||
const QDomElement dom = list.at(i).toElement();
|
|
||||||
const MeasurementDimension type = StrToDimensionType(GetParametrString(dom, AttrType));
|
|
||||||
const qreal min = GetParametrDouble(dom, AttrMin, QChar('0'));
|
|
||||||
const qreal max = GetParametrDouble(dom, AttrMax, QChar('0'));
|
|
||||||
const qreal step = GetParametrDouble(dom, AttrStep, QStringLiteral("-1"));
|
|
||||||
const qreal base = GetParametrDouble(dom, AttrBase, QChar('0'));
|
|
||||||
|
|
||||||
const DimesionLabels labels = ReadDimensionLabels(dom);
|
|
||||||
|
|
||||||
if (type == MeasurementDimension::X)
|
|
||||||
{
|
|
||||||
auto dimension = QSharedPointer<VXMeasurementDimension>::create(units, min, max, step);
|
|
||||||
dimension->SetBaseValue(base);
|
|
||||||
dimension->SetLabels(labels);
|
|
||||||
dimensionsCached->insert(type, dimension);
|
|
||||||
}
|
|
||||||
else if (type == MeasurementDimension::Y)
|
|
||||||
{
|
|
||||||
auto dimension = QSharedPointer<VYMeasurementDimension>::create(units, min, max, step);
|
|
||||||
dimension->SetBaseValue(base);
|
|
||||||
dimension->SetCircumference(GetParametrBool(dom, AttrCircumference, trueStr));
|
|
||||||
dimension->SetLabels(labels);
|
|
||||||
dimensionsCached->insert(type, dimension);
|
|
||||||
}
|
|
||||||
else if (type == MeasurementDimension::W)
|
|
||||||
{
|
|
||||||
auto dimension = QSharedPointer<VWMeasurementDimension>::create(units, min, max, step);
|
|
||||||
dimension->SetBaseValue(base);
|
|
||||||
dimension->SetLabels(labels);
|
|
||||||
dimensionsCached->insert(type, dimension);
|
|
||||||
}
|
|
||||||
else if (type == MeasurementDimension::Z)
|
|
||||||
{
|
|
||||||
auto dimension = QSharedPointer<VZMeasurementDimension>::create(units, min, max, step);
|
|
||||||
dimension->SetBaseValue(base);
|
|
||||||
dimension->SetLabels(labels);
|
|
||||||
dimensionsCached->insert(type, dimension);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return *dimensionsCached;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -976,7 +926,7 @@ void VMeasurements::SetDimensionLabels(const QMap<MeasurementDimension, Dimesion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dimensionsCached->clear(); // Invalidate cache
|
m_dimensions = ReadDimensions(); // Refresh cache
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1187,6 +1137,10 @@ void VMeasurements::CreateEmptyMultisizeFile(Unit unit,
|
||||||
this->appendChild(mElement);
|
this->appendChild(mElement);
|
||||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
||||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
||||||
|
|
||||||
|
// Cache data
|
||||||
|
m_units = unit;
|
||||||
|
m_dimensions = ReadDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1215,6 +1169,10 @@ void VMeasurements::CreateEmptyIndividualFile(Unit unit)
|
||||||
this->appendChild(mElement);
|
this->appendChild(mElement);
|
||||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
||||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), this->firstChild());
|
||||||
|
|
||||||
|
// Cache data
|
||||||
|
m_units = unit;
|
||||||
|
m_dimensions = ReadDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1246,7 +1204,7 @@ QDomElement VMeasurements::CreateDimensions(const QVector<MeasurementDimension_p
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VMeasurements::UniqueTagAttr(const QString &tag, const QString &attr, qreal defValue) const
|
qreal VMeasurements::UniqueTagAttr(const QString &tag, const QString &attr, qreal defValue) const
|
||||||
{
|
{
|
||||||
const qreal defVal = UnitConvertor(defValue, Unit::Cm, MUnit());
|
const qreal defVal = UnitConvertor(defValue, Unit::Cm, Units());
|
||||||
|
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
const QDomNodeList nodeList = this->elementsByTagName(tag);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
|
@ -1332,6 +1290,76 @@ MeasurementsType VMeasurements::ReadType() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VMeasurements::ReadUnits() const -> Unit
|
||||||
|
{
|
||||||
|
Unit units = StrToUnits(UniqueTagText(TagUnit, unitCM));
|
||||||
|
|
||||||
|
if (units == Unit::Px)
|
||||||
|
{
|
||||||
|
units = Unit::Cm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return units;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VMeasurements::ReadDimensions() const -> VDimensions
|
||||||
|
{
|
||||||
|
if (type != MeasurementsType::Multisize)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
VDimensions dimensions;
|
||||||
|
|
||||||
|
const Unit units = Units();
|
||||||
|
const QDomNodeList list = elementsByTagName(TagDimension);
|
||||||
|
for (int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
const QDomElement dom = list.at(i).toElement();
|
||||||
|
const MeasurementDimension type = StrToDimensionType(GetParametrString(dom, AttrType));
|
||||||
|
const qreal min = GetParametrDouble(dom, AttrMin, QChar('0'));
|
||||||
|
const qreal max = GetParametrDouble(dom, AttrMax, QChar('0'));
|
||||||
|
const qreal step = GetParametrDouble(dom, AttrStep, QStringLiteral("-1"));
|
||||||
|
const qreal base = GetParametrDouble(dom, AttrBase, QChar('0'));
|
||||||
|
|
||||||
|
const DimesionLabels labels = ReadDimensionLabels(dom);
|
||||||
|
|
||||||
|
if (type == MeasurementDimension::X)
|
||||||
|
{
|
||||||
|
auto dimension = QSharedPointer<VXMeasurementDimension>::create(units, min, max, step);
|
||||||
|
dimension->SetBaseValue(base);
|
||||||
|
dimension->SetLabels(labels);
|
||||||
|
dimensions.insert(type, dimension);
|
||||||
|
}
|
||||||
|
else if (type == MeasurementDimension::Y)
|
||||||
|
{
|
||||||
|
auto dimension = QSharedPointer<VYMeasurementDimension>::create(units, min, max, step);
|
||||||
|
dimension->SetBaseValue(base);
|
||||||
|
dimension->SetCircumference(GetParametrBool(dom, AttrCircumference, trueStr));
|
||||||
|
dimension->SetLabels(labels);
|
||||||
|
dimensions.insert(type, dimension);
|
||||||
|
}
|
||||||
|
else if (type == MeasurementDimension::W)
|
||||||
|
{
|
||||||
|
auto dimension = QSharedPointer<VWMeasurementDimension>::create(units, min, max, step);
|
||||||
|
dimension->SetBaseValue(base);
|
||||||
|
dimension->SetLabels(labels);
|
||||||
|
dimensions.insert(type, dimension);
|
||||||
|
}
|
||||||
|
else if (type == MeasurementDimension::Z)
|
||||||
|
{
|
||||||
|
auto dimension = QSharedPointer<VZMeasurementDimension>::create(units, min, max, step);
|
||||||
|
dimension->SetBaseValue(base);
|
||||||
|
dimension->SetLabels(labels);
|
||||||
|
dimensions.insert(type, dimension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dimensions;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool *ok) const
|
qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool *ok) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,8 @@ class VContainer;
|
||||||
|
|
||||||
enum class GenderType : qint8 { Male, Female, Unknown };
|
enum class GenderType : qint8 { Male, Female, Unknown };
|
||||||
|
|
||||||
|
using VDimensions = QMap<MeasurementDimension, MeasurementDimension_p>;
|
||||||
|
|
||||||
class VMeasurements : public VDomDocument
|
class VMeasurements : public VDomDocument
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(VMeasurements)
|
Q_DECLARE_TR_FUNCTIONS(VMeasurements)
|
||||||
|
@ -65,6 +67,8 @@ public:
|
||||||
void MoveDown(const QString &name);
|
void MoveDown(const QString &name);
|
||||||
void MoveBottom(const QString &name);
|
void MoveBottom(const QString &name);
|
||||||
|
|
||||||
|
auto Units() const -> Unit;
|
||||||
|
|
||||||
void StoreNames(bool store);
|
void StoreNames(bool store);
|
||||||
|
|
||||||
void ReadMeasurements(qreal baseA, qreal baseB=0, qreal baseC=0) const;
|
void ReadMeasurements(qreal baseA, qreal baseB=0, qreal baseC=0) const;
|
||||||
|
@ -117,7 +121,7 @@ public:
|
||||||
|
|
||||||
QString MeasurementForDimension(IMD type) const;
|
QString MeasurementForDimension(IMD type) const;
|
||||||
|
|
||||||
auto Dimensions() const -> QMap<MeasurementDimension, MeasurementDimension_p >;
|
auto Dimensions() const -> VDimensions;
|
||||||
|
|
||||||
auto GetRestrictions() const -> QMap<QString, VDimensionRestriction >;
|
auto GetRestrictions() const -> QMap<QString, VDimensionRestriction >;
|
||||||
void SetRestrictions(const QMap<QString, VDimensionRestriction > &restrictions);
|
void SetRestrictions(const QMap<QString, VDimensionRestriction > &restrictions);
|
||||||
|
@ -201,6 +205,10 @@ private:
|
||||||
VContainer *data;
|
VContainer *data;
|
||||||
MeasurementsType type;
|
MeasurementsType type;
|
||||||
|
|
||||||
|
// Cache data to quick access
|
||||||
|
Unit m_units{Unit::LAST_UNIT_DO_NOT_USE};
|
||||||
|
VDimensions m_dimensions{};
|
||||||
|
|
||||||
/** @brief m_keepNames store names in container to check uniqueness. */
|
/** @brief m_keepNames store names in container to check uniqueness. */
|
||||||
bool m_keepNames{true};
|
bool m_keepNames{true};
|
||||||
|
|
||||||
|
@ -214,6 +222,8 @@ private:
|
||||||
QDomElement MakeEmpty(const QString &name, const QString &formula);
|
QDomElement MakeEmpty(const QString &name, const QString &formula);
|
||||||
QDomElement FindM(const QString &name) const;
|
QDomElement FindM(const QString &name) const;
|
||||||
MeasurementsType ReadType() const;
|
MeasurementsType ReadType() const;
|
||||||
|
auto ReadUnits() const -> Unit;
|
||||||
|
auto ReadDimensions() const -> VDimensions;
|
||||||
|
|
||||||
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
|
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
|
||||||
|
|
||||||
|
|
|
@ -1665,10 +1665,8 @@ qreal VSAPoint::PassmarkLength(qreal width) const
|
||||||
passmarkLength = qMin(passmarkLength, maxPassmarkLength);
|
passmarkLength = qMin(passmarkLength, maxPassmarkLength);
|
||||||
return passmarkLength;
|
return passmarkLength;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return m_passmarkLength;
|
return m_passmarkLength;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2011-2018, Scott Tsai
|
/* Copyright (c) 2011-2021, Scott Tsai
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef DEBUG_BREAK_H
|
#ifndef DEBUG_BREAK_H
|
||||||
#define DEBUG_BREAK_H
|
#define DEBUG_BREAK_H
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ __inline__ static void trap_instruction(void)
|
||||||
#elif defined(__thumb__)
|
#elif defined(__thumb__)
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
/* FIXME: handle __THUMB_INTERWORK__ */
|
/* FIXME: handle __THUMB_INTERWORK__ */
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void trap_instruction(void)
|
__inline__ static void trap_instruction(void)
|
||||||
{
|
{
|
||||||
/* See 'arm-linux-tdep.c' in GDB source.
|
/* See 'arm-linux-tdep.c' in GDB source.
|
||||||
|
@ -82,7 +81,7 @@ __inline__ static void trap_instruction(void)
|
||||||
}
|
}
|
||||||
#elif defined(__arm__) && !defined(__thumb__)
|
#elif defined(__arm__) && !defined(__thumb__)
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void trap_instruction(void)
|
__inline__ static void trap_instruction(void)
|
||||||
{
|
{
|
||||||
/* See 'arm-linux-tdep.c' in GDB source,
|
/* See 'arm-linux-tdep.c' in GDB source,
|
||||||
|
@ -95,7 +94,7 @@ __inline__ static void trap_instruction(void)
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_BULTIN_TRAP
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_BULTIN_TRAP
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void trap_instruction(void)
|
__inline__ static void trap_instruction(void)
|
||||||
{
|
{
|
||||||
/* See 'aarch64-tdep.c' in GDB source,
|
/* See 'aarch64-tdep.c' in GDB source,
|
||||||
|
@ -105,7 +104,7 @@ __inline__ static void trap_instruction(void)
|
||||||
#elif defined(__powerpc__)
|
#elif defined(__powerpc__)
|
||||||
/* PPC 32 or 64-bit, big or little endian */
|
/* PPC 32 or 64-bit, big or little endian */
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void trap_instruction(void)
|
__inline__ static void trap_instruction(void)
|
||||||
{
|
{
|
||||||
/* See 'rs6000-tdep.c' in GDB source,
|
/* See 'rs6000-tdep.c' in GDB source,
|
||||||
|
@ -119,6 +118,17 @@ __inline__ static void trap_instruction(void)
|
||||||
* The workaround is the same as ARM Thumb mode: use debugbreak-gdb.py
|
* The workaround is the same as ARM Thumb mode: use debugbreak-gdb.py
|
||||||
* or manually jump over the instruction. */
|
* or manually jump over the instruction. */
|
||||||
}
|
}
|
||||||
|
#elif defined(__riscv)
|
||||||
|
/* RISC-V 32 or 64-bit, whether the "C" extension
|
||||||
|
* for compressed, 16-bit instructions are supported or not */
|
||||||
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
|
__attribute__((always_inline))
|
||||||
|
__inline__ static void trap_instruction(void)
|
||||||
|
{
|
||||||
|
/* See 'riscv-tdep.c' in GDB source,
|
||||||
|
* 'riscv_sw_breakpoint_from_kind' */
|
||||||
|
__asm__ volatile(".4byte 0x00100073");
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_SIGTRAP
|
#define DEBUG_BREAK_IMPL DEBUG_BREAK_USE_SIGTRAP
|
||||||
#endif
|
#endif
|
||||||
|
@ -127,20 +137,20 @@ __inline__ static void trap_instruction(void)
|
||||||
#ifndef DEBUG_BREAK_IMPL
|
#ifndef DEBUG_BREAK_IMPL
|
||||||
#error "debugbreak.h is not supported on this target"
|
#error "debugbreak.h is not supported on this target"
|
||||||
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_TRAP_INSTRUCTION
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void debug_break(void)
|
__inline__ static void debug_break(void)
|
||||||
{
|
{
|
||||||
trap_instruction();
|
trap_instruction();
|
||||||
}
|
}
|
||||||
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_BULTIN_TRAP
|
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_BULTIN_TRAP
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void debug_break(void)
|
__inline__ static void debug_break(void)
|
||||||
{
|
{
|
||||||
__builtin_trap();
|
__builtin_trap();
|
||||||
}
|
}
|
||||||
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_SIGTRAP
|
#elif DEBUG_BREAK_IMPL == DEBUG_BREAK_USE_SIGTRAP
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
__attribute__((gnu_inline, always_inline))
|
__attribute__((always_inline))
|
||||||
__inline__ static void debug_break(void)
|
__inline__ static void debug_break(void)
|
||||||
{
|
{
|
||||||
raise(SIGTRAP);
|
raise(SIGTRAP);
|
||||||
|
|
|
@ -34,4 +34,3 @@ const QString preferencesOtherIcon = QStringLiteral("preferences-other");
|
||||||
const QString degreeSymbol = QStringLiteral("°");
|
const QString degreeSymbol = QStringLiteral("°");
|
||||||
const QString trueStr = QStringLiteral("true");
|
const QString trueStr = QStringLiteral("true");
|
||||||
const QString falseStr = QStringLiteral("false");
|
const QString falseStr = QStringLiteral("false");
|
||||||
const QString unknownCharacter = QStringLiteral("<EFBFBD>");
|
|
||||||
|
|
|
@ -40,6 +40,5 @@ extern const QString preferencesOtherIcon;
|
||||||
extern const QString degreeSymbol;
|
extern const QString degreeSymbol;
|
||||||
extern const QString trueStr;
|
extern const QString trueStr;
|
||||||
extern const QString falseStr;
|
extern const QString falseStr;
|
||||||
extern const QString unknownCharacter;
|
|
||||||
|
|
||||||
#endif // LITERALS_H
|
#endif // LITERALS_H
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
extern const int MAJOR_VERSION = 0;
|
extern const int MAJOR_VERSION = 0;
|
||||||
extern const int MINOR_VERSION = 7;
|
extern const int MINOR_VERSION = 7;
|
||||||
extern const int DEBUG_VERSION = 46;
|
extern const int DEBUG_VERSION = 47;
|
||||||
|
|
||||||
extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
|
extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION)
|
||||||
.arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));
|
.arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));
|
||||||
|
|
|
@ -49,8 +49,8 @@ extern const QString APP_VERSION_STR;
|
||||||
// Change version number in projectversion.cpp too.
|
// Change version number in projectversion.cpp too.
|
||||||
// Synchronize valentina.nsi
|
// Synchronize valentina.nsi
|
||||||
|
|
||||||
#define VER_FILEVERSION 0,7,46
|
#define VER_FILEVERSION 0,7,47
|
||||||
#define VER_FILEVERSION_STR "0.7.46\0"
|
#define VER_FILEVERSION_STR "0.7.47\0"
|
||||||
|
|
||||||
#define V_PRERELEASE // Mark prerelease builds
|
#define V_PRERELEASE // Mark prerelease builds
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,6 @@ CONFIG(debug, debug|release){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINES += "LATEST_TAG_DISTANCE=$$FindLatestTagDistance()" # Make available latest tag distance number in sources.
|
DEFINES += LATEST_TAG_DISTANCE=\\\"$$FindLatestTagDistance()\\\" # Make available latest tag distance number in sources.
|
||||||
|
|
||||||
include (../libs.pri)
|
include (../libs.pri)
|
||||||
|
|
|
@ -537,6 +537,43 @@ QVector<QLineF> CreatePassmarkLines(PassmarkLineType lineType, PassmarkAngleType
|
||||||
return passmarksLines;
|
return passmarksLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto PassmarkLength(const VPiecePassmarkData &passmarkData, qreal width, bool &ok) -> qreal
|
||||||
|
{
|
||||||
|
qreal length = 0;
|
||||||
|
if (not passmarkData.passmarkSAPoint.IsManualPasskmarkLength())
|
||||||
|
{
|
||||||
|
if (passmarkData.globalPassmarkLength > accuracyPointOnLine)
|
||||||
|
{
|
||||||
|
ok = true;
|
||||||
|
return passmarkData.globalPassmarkLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = qMin(width * VSAPoint::passmarkFactor, VSAPoint::maxPassmarkLength);
|
||||||
|
|
||||||
|
if (length <= accuracyPointOnLine)
|
||||||
|
{
|
||||||
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
|
"than minimal allowed.")
|
||||||
|
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
|
||||||
|
ok = false;
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
ok = true;
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = passmarkData.passmarkSAPoint.GetPasskmarkLength();
|
||||||
|
|
||||||
|
ok = true;
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassmarkData &passmarkData,
|
QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const VPiecePassmarkData &passmarkData,
|
||||||
const QPointF &seamPassmarkSAPoint, const QVector<QPointF> &seamAllowance)
|
const QPointF &seamPassmarkSAPoint, const QVector<QPointF> &seamAllowance)
|
||||||
|
@ -572,14 +609,11 @@ QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal length = passmarkData.passmarkSAPoint.PassmarkLength(passmarkData.saWidth);
|
bool ok = false;
|
||||||
if (not passmarkData.passmarkSAPoint.IsManualPasskmarkLength() && length <= accuracyPointOnLine)
|
const qreal length = PassmarkLength(passmarkData, passmarkData.passmarkSAPoint.MaxLocalSA(passmarkData.saWidth),
|
||||||
|
ok);
|
||||||
|
if (not ok)
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
|
||||||
"than minimal allowed.")
|
|
||||||
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,6 +658,7 @@ QJsonObject VPiecePassmarkData::toJson() const
|
||||||
{"isShowSecondPassmark", isShowSecondPassmark},
|
{"isShowSecondPassmark", isShowSecondPassmark},
|
||||||
{"passmarkIndex", passmarkIndex},
|
{"passmarkIndex", passmarkIndex},
|
||||||
{"id", static_cast<qint64>(id)},
|
{"id", static_cast<qint64>(id)},
|
||||||
|
{"globalPassmarkLength", static_cast<qreal>(globalPassmarkLength)},
|
||||||
};
|
};
|
||||||
|
|
||||||
return dataObject;
|
return dataObject;
|
||||||
|
@ -781,15 +816,11 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
qreal length = 0;
|
qreal length = 0;
|
||||||
if (not piece.IsSeamAllowanceBuiltIn())
|
if (not piece.IsSeamAllowanceBuiltIn())
|
||||||
{
|
{
|
||||||
length = m_data.passmarkSAPoint.PassmarkLength(m_data.saWidth);
|
bool ok = false;
|
||||||
if (not m_data.passmarkSAPoint.IsManualPasskmarkLength() && length <= accuracyPointOnLine)
|
length = PassmarkLength(m_data, m_data.passmarkSAPoint.MaxLocalSA(m_data.saWidth), ok);
|
||||||
|
if (not ok)
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
return {};
|
||||||
"than minimal allowed.")
|
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
return QVector<QLineF>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -888,35 +919,24 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
if (intersections.last() != m_data.passmarkSAPoint)
|
if (intersections.last() != m_data.passmarkSAPoint)
|
||||||
{
|
{
|
||||||
line = QLineF(intersections.last(), m_data.passmarkSAPoint);
|
line = QLineF(intersections.last(), m_data.passmarkSAPoint);
|
||||||
if (not m_data.passmarkSAPoint.IsManualPasskmarkLength())
|
|
||||||
|
bool ok = false;
|
||||||
|
const qreal length = PassmarkLength(m_data, width, ok);
|
||||||
|
if (not ok)
|
||||||
{
|
{
|
||||||
const qreal length = qMin(width * VSAPoint::passmarkFactor, VSAPoint::maxPassmarkLength);
|
|
||||||
if (length <= accuracyPointOnLine)
|
|
||||||
{
|
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
|
|
||||||
"less than minimal allowed.")
|
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
return QLineF();
|
return QLineF();
|
||||||
}
|
}
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
line.setLength(m_data.passmarkSAPoint.GetPasskmarkLength());
|
|
||||||
}
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
||||||
"collapse.")
|
"collapse.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
||||||
|
@ -931,21 +951,17 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
|
|
||||||
if (m_data.passmarkAngleType == PassmarkAngleType::Straightforward)
|
if (m_data.passmarkAngleType == PassmarkAngleType::Straightforward)
|
||||||
{
|
{
|
||||||
const qreal length = m_data.passmarkSAPoint.PassmarkLength(m_data.saWidth);
|
bool ok = false;
|
||||||
if (not m_data.passmarkSAPoint.IsManualPasskmarkLength() && length <= accuracyPointOnLine)
|
const qreal length = PassmarkLength(m_data, m_data.passmarkSAPoint.MaxLocalSA(m_data.saWidth), ok);
|
||||||
|
|
||||||
|
if (not ok)
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
return {};
|
||||||
"than minimal allowed.")
|
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
|
||||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
QLineF line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint);
|
QLineF line = QLineF(seamPassmarkSAPoint, m_data.passmarkSAPoint);
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
return QVector<QLineF>({line});
|
return {line};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
else if (m_data.passmarkAngleType == PassmarkAngleType::Bisector)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,6 +61,7 @@ struct VPiecePassmarkData
|
||||||
bool isShowSecondPassmark{true};
|
bool isShowSecondPassmark{true};
|
||||||
int passmarkIndex{-1};
|
int passmarkIndex{-1};
|
||||||
vidtype id{NULL_ID};
|
vidtype id{NULL_ID};
|
||||||
|
qreal globalPassmarkLength{0};
|
||||||
|
|
||||||
QJsonObject toJson() const;
|
QJsonObject toJson() const;
|
||||||
};
|
};
|
||||||
|
@ -102,7 +103,6 @@ private:
|
||||||
bool m_null{true};
|
bool m_null{true};
|
||||||
|
|
||||||
QVector<QLineF> MakeSAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
QVector<QLineF> MakeSAPassmark(const QVector<QPointF> &seamAllowance, PassmarkSide side) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPASSMARK_H
|
#endif // VPASSMARK_H
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# File with common stuff for whole project
|
# File with common stuff for whole project
|
||||||
include(../../../common.pri)
|
include(../../../common.pri)
|
||||||
|
|
||||||
QT += core widgets printsupport
|
QT += core widgets printsupport xmlpatterns concurrent xml
|
||||||
|
|
||||||
# Name of the library
|
# Name of the library
|
||||||
TARGET = vpatterndb
|
TARGET = vpatterndb
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
#include "../ifc/exception/vexceptioninvalidnotch.h"
|
#include "../ifc/exception/vexceptioninvalidnotch.h"
|
||||||
#include "../vlayout/testpath.h"
|
#include "../vlayout/testpath.h"
|
||||||
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -1106,6 +1107,7 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
|
||||||
passmarkData.isShowSecondPassmark = path.at(passmarkIndex).IsShowSecondPassmark();
|
passmarkData.isShowSecondPassmark = path.at(passmarkIndex).IsShowSecondPassmark();
|
||||||
passmarkData.passmarkIndex = passmarkIndex;
|
passmarkData.passmarkIndex = passmarkIndex;
|
||||||
passmarkData.id = path.at(passmarkIndex).GetId();
|
passmarkData.id = path.at(passmarkIndex).GetId();
|
||||||
|
passmarkData.globalPassmarkLength = ToPixel(GlobalPassmarkLength(data), *data->GetPatternUnit());
|
||||||
|
|
||||||
return VPassmark(passmarkData);
|
return VPassmark(passmarkData);
|
||||||
}
|
}
|
||||||
|
@ -1170,6 +1172,39 @@ QJsonObject VPiece::DBToJson(const VContainer *data) const
|
||||||
return dbObject;
|
return dbObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VPiece::GlobalPassmarkLength(const VContainer *data) const -> qreal
|
||||||
|
{
|
||||||
|
qreal length = 0;
|
||||||
|
QString passmarkLengthVariable = VAbstractValApplication::VApp()->getCurrentDocument()->GetPassmarkLengthVariable();
|
||||||
|
if (passmarkLengthVariable.isEmpty())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QSharedPointer<VInternalVariable> var = data->GetVariable<VInternalVariable>(passmarkLengthVariable);
|
||||||
|
length = *var->GetValue();
|
||||||
|
|
||||||
|
if (length <= accuracyPointOnLine)
|
||||||
|
{
|
||||||
|
const QString errorMsg = QObject::tr("Invalid global value for a passmark length. Piece '%1'. Length is "
|
||||||
|
"less than minimal allowed.")
|
||||||
|
.arg(GetName());
|
||||||
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const VExceptionBadId &)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPiece::DumpPiece(const VPiece &piece, const VContainer *data)
|
void VPiece::DumpPiece(const VPiece &piece, const VContainer *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,6 +158,8 @@ private:
|
||||||
|
|
||||||
QJsonObject MainPathToJson() const;
|
QJsonObject MainPathToJson() const;
|
||||||
QJsonObject DBToJson(const VContainer *data) const;
|
QJsonObject DBToJson(const VContainer *data) const;
|
||||||
|
|
||||||
|
qreal GlobalPassmarkLength(const VContainer *data) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
Q_DECLARE_TYPEINFO(VPiece, Q_MOVABLE_TYPE);
|
||||||
|
|
|
@ -266,6 +266,11 @@ void AbstractTest::PassmarkDataFromJson(const QString &json, VPiecePassmarkData
|
||||||
vidtype id;
|
vidtype id;
|
||||||
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("id"), id, QString::number(NULL_ID));
|
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("id"), id, QString::number(NULL_ID));
|
||||||
data.id = id;
|
data.id = id;
|
||||||
|
|
||||||
|
qreal globalPassmarkLength;
|
||||||
|
AbstractTest::ReadDoubleValue(passmarkData, QStringLiteral("globalPassmarkLength"), globalPassmarkLength,
|
||||||
|
QString::number(NULL_ID));
|
||||||
|
data.globalPassmarkLength = globalPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -36,6 +36,12 @@
|
||||||
#include "../vpatterndb/variables/vcurvelength.h"
|
#include "../vpatterndb/variables/vcurvelength.h"
|
||||||
#include "../ifc/exception/vexceptionbadid.h"
|
#include "../ifc/exception/vexceptionbadid.h"
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
|
#include "../vgeometry/varc.h"
|
||||||
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
|
#include "../vgeometry/vspline.h"
|
||||||
|
#include "../vgeometry/vsplinepath.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -106,7 +112,20 @@ bool DoubleCurve(const VPieceNode &firstNode, const VPieceNode &secondNode)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template <class T>
|
||||||
|
auto CurveAliases(const QString &alias1, const QString &alias2) -> QPair<QString, QString>
|
||||||
|
{
|
||||||
|
T curve1;
|
||||||
|
curve1.SetAliasSuffix(alias1);
|
||||||
|
|
||||||
|
T curve2;
|
||||||
|
curve2.SetAliasSuffix(alias2);
|
||||||
|
|
||||||
|
return qMakePair(curve1.GetAlias(), curve2.GetAlias());
|
||||||
}
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceNode RowNode(QListWidget *listWidget, int i)
|
VPieceNode RowNode(QListWidget *listWidget, int i)
|
||||||
|
@ -527,3 +546,33 @@ QIcon LineColor(int size, const QString &color)
|
||||||
pix.fill(QColor(color));
|
pix.fill(QColor(color));
|
||||||
return QIcon(pix);
|
return QIcon(pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QT_WARNING_PUSH
|
||||||
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alias2) -> QPair<QString, QString>
|
||||||
|
{
|
||||||
|
switch(curveType)
|
||||||
|
{
|
||||||
|
case GOType::EllipticalArc:
|
||||||
|
return CurveAliases<VEllipticalArc>(alias1, alias2);
|
||||||
|
case GOType::Arc:
|
||||||
|
return CurveAliases<VArc>(alias1, alias2);
|
||||||
|
case GOType::CubicBezier:
|
||||||
|
return CurveAliases<VCubicBezier>(alias1, alias2);
|
||||||
|
case GOType::Spline:
|
||||||
|
return CurveAliases<VSpline>(alias1, alias2);
|
||||||
|
case GOType::CubicBezierPath:
|
||||||
|
return CurveAliases<VCubicBezierPath>(alias1, alias2);
|
||||||
|
case GOType::SplinePath:
|
||||||
|
return CurveAliases<VSplinePath>(alias1, alias2);
|
||||||
|
case GOType::Point:
|
||||||
|
case GOType::PlaceLabel:
|
||||||
|
case GOType::Unknown:
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
QT_WARNING_POP
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
#include "../vpatterndb/variables/vinternalvariable.h"
|
#include "../vpatterndb/variables/vinternalvariable.h"
|
||||||
#include "../vmisc/typedef.h"
|
#include "../vmisc/typedef.h"
|
||||||
|
#include "../vgeometry/vgeometrydef.h"
|
||||||
|
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
@ -88,5 +89,6 @@ QFont NodeFont(QFont font, bool nodeExcluded = false);
|
||||||
void CurrentCurveLength(vidtype curveId, VContainer *data);
|
void CurrentCurveLength(vidtype curveId, VContainer *data);
|
||||||
void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar=4);
|
void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar=4);
|
||||||
QIcon LineColor(int size, const QString &color);
|
QIcon LineColor(int size, const QString &color);
|
||||||
|
auto SegmentAliases(GOType curveType, const QString &alias1, const QString &alias2) -> QPair<QString, QString>;
|
||||||
|
|
||||||
#endif // DIALOGTOOLBOX_H
|
#endif // DIALOGTOOLBOX_H
|
||||||
|
|
|
@ -51,6 +51,8 @@
|
||||||
#include "../support/dialogeditwrongformula.h"
|
#include "../support/dialogeditwrongformula.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vmisc/vcommonsettings.h"
|
#include "../vmisc/vcommonsettings.h"
|
||||||
|
#include "../qmuparser/qmudef.h"
|
||||||
|
#include "../dialogtoolbox.h"
|
||||||
#include "ui_dialogcurveintersectaxis.h"
|
#include "ui_dialogcurveintersectaxis.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -95,6 +97,8 @@ DialogCurveIntersectAxis::DialogCurveIntersectAxis(const VContainer *data, quint
|
||||||
});
|
});
|
||||||
connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::DeployAngleTextEdit);
|
connect(ui->pushButtonGrowLengthAngle, &QPushButton::clicked, this, &DialogCurveIntersectAxis::DeployAngleTextEdit);
|
||||||
connect(timerFormula, &QTimer::timeout, this, &DialogCurveIntersectAxis::EvalAngle);
|
connect(timerFormula, &QTimer::timeout, this, &DialogCurveIntersectAxis::EvalAngle);
|
||||||
|
connect(ui->lineEditAlias1, &QLineEdit::textEdited, this, &DialogCurveIntersectAxis::ValidateAlias);
|
||||||
|
connect(ui->lineEditAlias2, &QLineEdit::textEdited, this, &DialogCurveIntersectAxis::ValidateAlias);
|
||||||
|
|
||||||
vis = new VisToolCurveIntersectAxis(data);
|
vis = new VisToolCurveIntersectAxis(data);
|
||||||
|
|
||||||
|
@ -352,6 +356,46 @@ void DialogCurveIntersectAxis::closeEvent(QCloseEvent *event)
|
||||||
DialogTool::closeEvent(event);
|
DialogTool::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCurveIntersectAxis::ValidateAlias()
|
||||||
|
{
|
||||||
|
QRegularExpression rx(NameRegExp());
|
||||||
|
|
||||||
|
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(getCurveId());
|
||||||
|
QPair<QString, QString> alias = SegmentAliases(curve->getType(), GetAliasSuffix1(), GetAliasSuffix2());
|
||||||
|
|
||||||
|
|
||||||
|
if (not GetAliasSuffix1().isEmpty() &&
|
||||||
|
(not rx.match(alias.first).hasMatch() ||
|
||||||
|
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(alias.first)) ||
|
||||||
|
alias.first == alias.second))
|
||||||
|
{
|
||||||
|
flagAlias1 = false;
|
||||||
|
ChangeColor(ui->labelAlias1, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias1 = true;
|
||||||
|
ChangeColor(ui->labelAlias1, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not GetAliasSuffix2().isEmpty() &&
|
||||||
|
(not rx.match(alias.second).hasMatch() ||
|
||||||
|
(originAliasSuffix2 != GetAliasSuffix2() && not data->IsUnique(alias.second)) ||
|
||||||
|
alias.first == alias.second))
|
||||||
|
{
|
||||||
|
flagAlias2 = false;
|
||||||
|
ChangeColor(ui->labelAlias2, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias2 = true;
|
||||||
|
ChangeColor(ui->labelAlias2, OkColor(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogCurveIntersectAxis::SetNotes(const QString ¬es)
|
void DialogCurveIntersectAxis::SetNotes(const QString ¬es)
|
||||||
{
|
{
|
||||||
|
@ -363,3 +407,31 @@ QString DialogCurveIntersectAxis::GetNotes() const
|
||||||
{
|
{
|
||||||
return ui->plainTextEditToolNotes->toPlainText();
|
return ui->plainTextEditToolNotes->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCurveIntersectAxis::SetAliasSuffix1(const QString &alias)
|
||||||
|
{
|
||||||
|
originAliasSuffix1 = alias;
|
||||||
|
ui->lineEditAlias1->setText(originAliasSuffix1);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogCurveIntersectAxis::GetAliasSuffix1() const
|
||||||
|
{
|
||||||
|
return ui->lineEditAlias1->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogCurveIntersectAxis::SetAliasSuffix2(const QString &alias)
|
||||||
|
{
|
||||||
|
originAliasSuffix2 = alias;
|
||||||
|
ui->lineEditAlias2->setText(originAliasSuffix2);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogCurveIntersectAxis::GetAliasSuffix2() const
|
||||||
|
{
|
||||||
|
return ui->lineEditAlias2->text();
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,12 @@ public:
|
||||||
void SetNotes(const QString ¬es);
|
void SetNotes(const QString ¬es);
|
||||||
QString GetNotes() const;
|
QString GetNotes() const;
|
||||||
|
|
||||||
|
void SetAliasSuffix1(const QString &alias);
|
||||||
|
QString GetAliasSuffix1() const;
|
||||||
|
|
||||||
|
void SetAliasSuffix2(const QString &alias);
|
||||||
|
QString GetAliasSuffix2() const;
|
||||||
|
|
||||||
virtual void ShowDialog(bool click) override;
|
virtual void ShowDialog(bool click) override;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||||
|
@ -86,6 +92,8 @@ protected:
|
||||||
virtual void SaveData() override;
|
virtual void SaveData() override;
|
||||||
virtual void closeEvent(QCloseEvent *event) override;
|
virtual void closeEvent(QCloseEvent *event) override;
|
||||||
virtual bool IsValid() const final;
|
virtual bool IsValid() const final;
|
||||||
|
private slots:
|
||||||
|
void ValidateAlias();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogCurveIntersectAxis)
|
Q_DISABLE_COPY(DialogCurveIntersectAxis)
|
||||||
Ui::DialogCurveIntersectAxis *ui;
|
Ui::DialogCurveIntersectAxis *ui;
|
||||||
|
@ -101,12 +109,17 @@ private:
|
||||||
|
|
||||||
bool flagFormula;
|
bool flagFormula;
|
||||||
bool flagName;
|
bool flagName;
|
||||||
|
bool flagAlias1{true};
|
||||||
|
bool flagAlias2{true};
|
||||||
|
|
||||||
|
QString originAliasSuffix1{};
|
||||||
|
QString originAliasSuffix2{};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline bool DialogCurveIntersectAxis::IsValid() const
|
inline bool DialogCurveIntersectAxis::IsValid() const
|
||||||
{
|
{
|
||||||
return flagFormula && flagName;
|
return flagFormula && flagName && flagAlias1 && flagAlias2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DIALOGCURVEINTERSECTAXIS_H
|
#endif // DIALOGCURVEINTERSECTAXIS_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>335</width>
|
<width>324</width>
|
||||||
<height>331</height>
|
<height>394</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -320,6 +320,34 @@
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxLineColor"/>
|
<widget class="QComboBox" name="comboBoxLineColor"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlias1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditAlias1">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="labelAlias2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditAlias2">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -219,7 +219,7 @@ void DialogCutArc::ValidateAlias()
|
||||||
|
|
||||||
if (not GetAliasSuffix1().isEmpty() &&
|
if (not GetAliasSuffix1().isEmpty() &&
|
||||||
(not rx.match(arc1.GetAlias()).hasMatch() ||
|
(not rx.match(arc1.GetAlias()).hasMatch() ||
|
||||||
(originAliasSuffix2 != GetAliasSuffix1() && not data->IsUnique(arc1.GetAlias())) ||
|
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(arc1.GetAlias())) ||
|
||||||
arc1.GetAlias() == arc2.GetAlias()))
|
arc1.GetAlias() == arc2.GetAlias()))
|
||||||
{
|
{
|
||||||
flagAlias1 = false;
|
flagAlias1 = false;
|
||||||
|
|
|
@ -227,7 +227,7 @@ void DialogCutSpline::ValidateAlias()
|
||||||
|
|
||||||
if (not GetAliasSuffix1().isEmpty() &&
|
if (not GetAliasSuffix1().isEmpty() &&
|
||||||
(not rx.match(spl1.GetAlias()).hasMatch() ||
|
(not rx.match(spl1.GetAlias()).hasMatch() ||
|
||||||
(originAliasSuffix2 != GetAliasSuffix1() && not data->IsUnique(spl1.GetAlias())) ||
|
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(spl1.GetAlias())) ||
|
||||||
spl1.GetAlias() == spl2.GetAlias()))
|
spl1.GetAlias() == spl2.GetAlias()))
|
||||||
{
|
{
|
||||||
flagAlias1 = false;
|
flagAlias1 = false;
|
||||||
|
|
|
@ -227,7 +227,7 @@ void DialogCutSplinePath::ValidateAlias()
|
||||||
|
|
||||||
if (not GetAliasSuffix1().isEmpty() &&
|
if (not GetAliasSuffix1().isEmpty() &&
|
||||||
(not rx.match(path1.GetAlias()).hasMatch() ||
|
(not rx.match(path1.GetAlias()).hasMatch() ||
|
||||||
(originAliasSuffix2 != GetAliasSuffix1() && not data->IsUnique(path1.GetAlias())) ||
|
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(path1.GetAlias())) ||
|
||||||
path1.GetAlias() == path2.GetAlias()))
|
path1.GetAlias() == path2.GetAlias()))
|
||||||
{
|
{
|
||||||
flagAlias1 = false;
|
flagAlias1 = false;
|
||||||
|
|
|
@ -38,7 +38,9 @@
|
||||||
#include "../../visualization/path/vistoolpointofintersectioncurves.h"
|
#include "../../visualization/path/vistoolpointofintersectioncurves.h"
|
||||||
#include "../../visualization/visualization.h"
|
#include "../../visualization/visualization.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "dialogtool.h"
|
#include "../qmuparser/qmudef.h"
|
||||||
|
#include "../dialogtoolbox.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "ui_dialogpointofintersectioncurves.h"
|
#include "ui_dialogpointofintersectioncurves.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -72,6 +74,10 @@ DialogPointOfIntersectionCurves::DialogPointOfIntersectionCurves(const VContaine
|
||||||
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
||||||
connect(ui->comboBoxCurve2, &QComboBox::currentTextChanged,
|
connect(ui->comboBoxCurve2, &QComboBox::currentTextChanged,
|
||||||
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
this, &DialogPointOfIntersectionCurves::CurveChanged);
|
||||||
|
connect(ui->lineEditCurve1Alias1, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
|
||||||
|
connect(ui->lineEditCurve1Alias2, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
|
||||||
|
connect(ui->lineEditCurve2Alias1, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
|
||||||
|
connect(ui->lineEditCurve2Alias2, &QLineEdit::textEdited, this, &DialogPointOfIntersectionCurves::ValidateAlias);
|
||||||
|
|
||||||
vis = new VisToolPointOfIntersectionCurves(data);
|
vis = new VisToolPointOfIntersectionCurves(data);
|
||||||
|
|
||||||
|
@ -252,6 +258,65 @@ void DialogPointOfIntersectionCurves::CurveChanged()
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersectionCurves::ValidateAlias()
|
||||||
|
{
|
||||||
|
QRegularExpression rx(NameRegExp());
|
||||||
|
|
||||||
|
const QSharedPointer<VAbstractCurve> curve1 = data->GeometricObject<VAbstractCurve>(GetFirstCurveId());
|
||||||
|
QPair<QString, QString> curve1Alias = SegmentAliases(curve1->getType(), GetCurve1AliasSuffix1(),
|
||||||
|
GetCurve1AliasSuffix2());
|
||||||
|
|
||||||
|
const QSharedPointer<VAbstractCurve> curve2 = data->GeometricObject<VAbstractCurve>(GetSecondCurveId());
|
||||||
|
QPair<QString, QString> curve2Alias = SegmentAliases(curve2->getType(), GetCurve2AliasSuffix1(),
|
||||||
|
GetCurve2AliasSuffix2());
|
||||||
|
|
||||||
|
QSet<QString> uniqueAliases;
|
||||||
|
int countAliases = 0;
|
||||||
|
|
||||||
|
auto CountUniqueAliases = [&countAliases, &uniqueAliases](const QString &alias)
|
||||||
|
{
|
||||||
|
if (not alias.isEmpty())
|
||||||
|
{
|
||||||
|
uniqueAliases.insert(alias);
|
||||||
|
++countAliases;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CountUniqueAliases(curve1Alias.first);
|
||||||
|
CountUniqueAliases(curve1Alias.second);
|
||||||
|
CountUniqueAliases(curve2Alias.first);
|
||||||
|
CountUniqueAliases(curve2Alias.second);
|
||||||
|
|
||||||
|
auto Validate = [countAliases, uniqueAliases, rx, this](const QString &originalSuffix, const QString &suffix,
|
||||||
|
const QString &alias, bool &flagAlias, QLabel *label)
|
||||||
|
{
|
||||||
|
if (not suffix.isEmpty() &&
|
||||||
|
(not rx.match(alias).hasMatch() || (originalSuffix != suffix && not data->IsUnique(alias)) ||
|
||||||
|
countAliases != uniqueAliases.size()))
|
||||||
|
{
|
||||||
|
flagAlias = false;
|
||||||
|
ChangeColor(label, errorColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
flagAlias = true;
|
||||||
|
ChangeColor(label, OkColor(this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Validate(originCurve1AliasSuffix1, GetCurve1AliasSuffix1(), curve1Alias.first, flagCurve1Alias1,
|
||||||
|
ui->labelCurve1Alias1);
|
||||||
|
Validate(originCurve1AliasSuffix2, GetCurve1AliasSuffix2(), curve1Alias.second, flagCurve1Alias2,
|
||||||
|
ui->labelCurve1Alias2);
|
||||||
|
Validate(originCurve2AliasSuffix1, GetCurve2AliasSuffix1(), curve2Alias.first, flagCurve2Alias1,
|
||||||
|
ui->labelCurve2Alias1);
|
||||||
|
Validate(originCurve2AliasSuffix2, GetCurve2AliasSuffix2(), curve2Alias.second, flagCurve2Alias2,
|
||||||
|
ui->labelCurve2Alias2);
|
||||||
|
|
||||||
|
CheckState();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPointOfIntersectionCurves::SetNotes(const QString ¬es)
|
void DialogPointOfIntersectionCurves::SetNotes(const QString ¬es)
|
||||||
{
|
{
|
||||||
|
@ -263,3 +328,59 @@ QString DialogPointOfIntersectionCurves::GetNotes() const
|
||||||
{
|
{
|
||||||
return ui->plainTextEditToolNotes->toPlainText();
|
return ui->plainTextEditToolNotes->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersectionCurves::SetCurve1AliasSuffix1(const QString &alias)
|
||||||
|
{
|
||||||
|
originCurve1AliasSuffix1 = alias;
|
||||||
|
ui->lineEditCurve1Alias1->setText(originCurve1AliasSuffix1);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPointOfIntersectionCurves::GetCurve1AliasSuffix1() const
|
||||||
|
{
|
||||||
|
return ui->lineEditCurve1Alias1->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersectionCurves::SetCurve1AliasSuffix2(const QString &alias)
|
||||||
|
{
|
||||||
|
originCurve1AliasSuffix2 = alias;
|
||||||
|
ui->lineEditCurve1Alias2->setText(originCurve1AliasSuffix2);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPointOfIntersectionCurves::GetCurve1AliasSuffix2() const
|
||||||
|
{
|
||||||
|
return ui->lineEditCurve1Alias2->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersectionCurves::SetCurve2AliasSuffix1(const QString &alias)
|
||||||
|
{
|
||||||
|
originCurve2AliasSuffix1 = alias;
|
||||||
|
ui->lineEditCurve2Alias1->setText(originCurve2AliasSuffix1);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPointOfIntersectionCurves::GetCurve2AliasSuffix1() const
|
||||||
|
{
|
||||||
|
return ui->lineEditCurve2Alias1->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersectionCurves::SetCurve2AliasSuffix2(const QString &alias)
|
||||||
|
{
|
||||||
|
originCurve2AliasSuffix2 = alias;
|
||||||
|
ui->lineEditCurve2Alias2->setText(originCurve2AliasSuffix2);
|
||||||
|
ValidateAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPointOfIntersectionCurves::GetCurve2AliasSuffix2() const
|
||||||
|
{
|
||||||
|
return ui->lineEditCurve2Alias2->text();
|
||||||
|
}
|
||||||
|
|
|
@ -69,6 +69,18 @@ public:
|
||||||
void SetNotes(const QString ¬es);
|
void SetNotes(const QString ¬es);
|
||||||
QString GetNotes() const;
|
QString GetNotes() const;
|
||||||
|
|
||||||
|
void SetCurve1AliasSuffix1(const QString &alias);
|
||||||
|
QString GetCurve1AliasSuffix1() const;
|
||||||
|
|
||||||
|
void SetCurve1AliasSuffix2(const QString &alias);
|
||||||
|
QString GetCurve1AliasSuffix2() const;
|
||||||
|
|
||||||
|
void SetCurve2AliasSuffix1(const QString &alias);
|
||||||
|
QString GetCurve2AliasSuffix1() const;
|
||||||
|
|
||||||
|
void SetCurve2AliasSuffix2(const QString &alias);
|
||||||
|
QString GetCurve2AliasSuffix2() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
virtual void ChosenObject(quint32 id, const SceneObject &type) override;
|
||||||
|
|
||||||
|
@ -83,6 +95,7 @@ protected:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void CurveChanged();
|
void CurveChanged();
|
||||||
|
void ValidateAlias();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogPointOfIntersectionCurves)
|
Q_DISABLE_COPY(DialogPointOfIntersectionCurves)
|
||||||
|
@ -93,12 +106,21 @@ private:
|
||||||
|
|
||||||
bool flagName;
|
bool flagName;
|
||||||
bool flagError;
|
bool flagError;
|
||||||
|
bool flagCurve1Alias1{true};
|
||||||
|
bool flagCurve1Alias2{true};
|
||||||
|
bool flagCurve2Alias1{true};
|
||||||
|
bool flagCurve2Alias2{true};
|
||||||
|
|
||||||
|
QString originCurve1AliasSuffix1{};
|
||||||
|
QString originCurve1AliasSuffix2{};
|
||||||
|
QString originCurve2AliasSuffix1{};
|
||||||
|
QString originCurve2AliasSuffix2{};
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline bool DialogPointOfIntersectionCurves::IsValid() const
|
inline bool DialogPointOfIntersectionCurves::IsValid() const
|
||||||
{
|
{
|
||||||
return flagName && flagError;
|
return flagName && flagError && flagCurve1Alias1 && flagCurve1Alias2 && flagCurve2Alias1 && flagCurve2Alias2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DIALOGPOINTOFINTERSECTIONCURVES_H
|
#endif // DIALOGPOINTOFINTERSECTIONCURVES_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>304</width>
|
<width>324</width>
|
||||||
<height>242</height>
|
<height>463</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<iconset resource="../../../vmisc/share/resources/icon.qrc">
|
<iconset resource="../../../vmisc/share/resources/icon.qrc">
|
||||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
|
@ -27,10 +27,9 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Tool</string>
|
<string>Tool</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="fieldGrowthPolicy">
|
<item>
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
<layout class="QFormLayout" name="formLayout">
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="labelCurve1">
|
<widget class="QLabel" name="labelCurve1">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -117,6 +116,82 @@
|
||||||
<widget class="QComboBox" name="comboBoxHCorrection"/>
|
<widget class="QComboBox" name="comboBoxHCorrection"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Curve 1</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelCurve1Alias1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditCurve1Alias1">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelCurve1Alias2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditCurve1Alias2">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Curve 2</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="labelCurve2Alias1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditCurve2Alias1">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="labelCurve2Alias2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alias2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineEditCurve2Alias2">
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_2">
|
<widget class="QWidget" name="tab_2">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
|
@ -200,6 +200,6 @@ void VToolCut::ReadToolAttributes(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
VToolSinglePoint::ReadToolAttributes(domElement);
|
VToolSinglePoint::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
m_aliasSuffix1 = doc->GetParametrEmptyString(domElement, AttrAlias1);
|
m_aliasSuffix1 = VAbstractPattern::GetParametrEmptyString(domElement, AttrAlias1);
|
||||||
m_aliasSuffix2 = doc->GetParametrEmptyString(domElement, AttrAlias2);
|
m_aliasSuffix2 = VAbstractPattern::GetParametrEmptyString(domElement, AttrAlias2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,8 +298,12 @@ QString VToolCutArc::MakeToolTip() const
|
||||||
VArc ar1;
|
VArc ar1;
|
||||||
VArc ar2;
|
VArc ar2;
|
||||||
arc->CutArc(VAbstractValApplication::VApp()->toPixel(length), ar1, ar2);
|
arc->CutArc(VAbstractValApplication::VApp()->toPixel(length), ar1, ar2);
|
||||||
|
|
||||||
ar1.setId(m_id + 1);
|
ar1.setId(m_id + 1);
|
||||||
|
ar1.SetAliasSuffix(m_aliasSuffix1);
|
||||||
|
|
||||||
ar2.setId(m_id + 2);
|
ar2.setId(m_id + 2);
|
||||||
|
ar2.SetAliasSuffix(m_aliasSuffix2);
|
||||||
|
|
||||||
auto ArcToolTip = [arcStr, lengthStr, startAngleStr, endAngleStr, radiusStr](QString toolTip, const VArc &arc,
|
auto ArcToolTip = [arcStr, lengthStr, startAngleStr, endAngleStr, radiusStr](QString toolTip, const VArc &arc,
|
||||||
const QString &arcNumber)
|
const QString &arcNumber)
|
||||||
|
|
|
@ -290,7 +290,10 @@ QString VToolCutSpline::MakeToolTip() const
|
||||||
QPointF point = spl->CutSpline(VAbstractValApplication::VApp()->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3);
|
QPointF point = spl->CutSpline(VAbstractValApplication::VApp()->toPixel(length), spl1p2, spl1p3, spl2p2, spl2p3);
|
||||||
|
|
||||||
VSpline spline1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(point));
|
VSpline spline1 = VSpline(spl->GetP1(), spl1p2, spl1p3, VPointF(point));
|
||||||
|
spline1.SetAliasSuffix(m_aliasSuffix1);
|
||||||
|
|
||||||
VSpline spline2 = VSpline(VPointF(point), spl2p2, spl2p3, spl->GetP4());
|
VSpline spline2 = VSpline(VPointF(point), spl2p2, spl2p3, spl->GetP4());
|
||||||
|
spline2.SetAliasSuffix(m_aliasSuffix2);
|
||||||
|
|
||||||
const QString curveStr = tr("Curve");
|
const QString curveStr = tr("Curve");
|
||||||
const QString lengthStr = tr("length");
|
const QString lengthStr = tr("length");
|
||||||
|
|
|
@ -388,6 +388,9 @@ QString VToolCutSplinePath::MakeToolTip() const
|
||||||
VAbstractValApplication::VApp()->toPixel(length), splPath, "X", &splPath1, &splPath2);
|
VAbstractValApplication::VApp()->toPixel(length), splPath, "X", &splPath1, &splPath2);
|
||||||
delete p; // Don't need this point
|
delete p; // Don't need this point
|
||||||
|
|
||||||
|
splPath1->SetAliasSuffix(m_aliasSuffix1);
|
||||||
|
splPath2->SetAliasSuffix(m_aliasSuffix2);
|
||||||
|
|
||||||
const QString curveStr = tr("Curve");
|
const QString curveStr = tr("Curve");
|
||||||
const QString lengthStr = tr("length");
|
const QString lengthStr = tr("length");
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,10 @@ VToolCurveIntersectAxis::VToolCurveIntersectAxis(const VToolCurveIntersectAxisIn
|
||||||
:VToolLinePoint(initData.doc, initData.data, initData.id, initData.typeLine, initData.lineColor, QString(),
|
:VToolLinePoint(initData.doc, initData.data, initData.id, initData.typeLine, initData.lineColor, QString(),
|
||||||
initData.basePointId, 0, initData.notes, parent),
|
initData.basePointId, 0, initData.notes, parent),
|
||||||
formulaAngle(initData.formulaAngle),
|
formulaAngle(initData.formulaAngle),
|
||||||
curveId(initData.curveId)
|
curveId(initData.curveId),
|
||||||
|
m_segments(initData.segments),
|
||||||
|
m_aliasSuffix1(initData.aliasSuffix1),
|
||||||
|
m_aliasSuffix2(initData.aliasSuffix2)
|
||||||
{
|
{
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -96,6 +99,8 @@ void VToolCurveIntersectAxis::setDialog()
|
||||||
dialogTool->setCurveId(curveId);
|
dialogTool->setCurveId(curveId);
|
||||||
dialogTool->SetPointName(p->name());
|
dialogTool->SetPointName(p->name());
|
||||||
dialogTool->SetNotes(m_notes);
|
dialogTool->SetNotes(m_notes);
|
||||||
|
dialogTool->SetAliasSuffix1(m_aliasSuffix1);
|
||||||
|
dialogTool->SetAliasSuffix2(m_aliasSuffix2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -120,6 +125,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(const QPointer<DialogTo
|
||||||
initData.parse = Document::FullParse;
|
initData.parse = Document::FullParse;
|
||||||
initData.typeCreation = Source::FromGui;
|
initData.typeCreation = Source::FromGui;
|
||||||
initData.notes = dialogTool->GetNotes();
|
initData.notes = dialogTool->GetNotes();
|
||||||
|
initData.aliasSuffix1 = dialogTool->GetAliasSuffix1();
|
||||||
|
initData.aliasSuffix2 = dialogTool->GetAliasSuffix2();
|
||||||
|
|
||||||
VToolCurveIntersectAxis *point = Create(initData);
|
VToolCurveIntersectAxis *point = Create(initData);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
|
@ -160,14 +167,16 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis
|
||||||
|
|
||||||
initData.data->getNextId();
|
initData.data->getNextId();
|
||||||
initData.data->getNextId();
|
initData.data->getNextId();
|
||||||
VToolSinglePoint::InitSegments(curve->getType(), segLength, p, initData.curveId, initData.data);
|
initData.segments = VToolSinglePoint::InitSegments(curve->getType(), segLength, p, initData.curveId,
|
||||||
|
initData.data, initData.aliasSuffix1, initData.aliasSuffix2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initData.data->UpdateGObject(initData.id, p);
|
initData.data->UpdateGObject(initData.id, p);
|
||||||
initData.data->AddLine(initData.basePointId, initData.id);
|
initData.data->AddLine(initData.basePointId, initData.id);
|
||||||
|
|
||||||
VToolSinglePoint::InitSegments(curve->getType(), segLength, p, initData.curveId, initData.data);
|
initData.segments = VToolSinglePoint::InitSegments(curve->getType(), segLength, p, initData.curveId,
|
||||||
|
initData.data, initData.aliasSuffix1, initData.aliasSuffix2);
|
||||||
|
|
||||||
if (initData.parse != Document::FullParse)
|
if (initData.parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
|
@ -186,6 +195,10 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis
|
||||||
initData.doc->IncrementReferens(curve->getIdTool());
|
initData.doc->IncrementReferens(curve->getIdTool());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto *tool = qobject_cast<VToolCurveIntersectAxis *>(VAbstractPattern::getTool(initData.id));
|
||||||
|
tool->SetSegments(initData.segments);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,6 +277,10 @@ void VToolCurveIntersectAxis::SaveDialog(QDomElement &domElement, QList<quint32>
|
||||||
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
doc->SetAttribute(domElement, AttrAngle, dialogTool->GetAngle());
|
||||||
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->GetBasePointId()));
|
||||||
doc->SetAttribute(domElement, AttrCurve, QString().setNum(dialogTool->getCurveId()));
|
doc->SetAttribute(domElement, AttrCurve, QString().setNum(dialogTool->getCurveId()));
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrAlias1, dialogTool->GetAliasSuffix1(),
|
||||||
|
dialogTool->GetAliasSuffix1().isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrAlias2, dialogTool->GetAliasSuffix2(),
|
||||||
|
dialogTool->GetAliasSuffix2().isEmpty());
|
||||||
|
|
||||||
const QString notes = dialogTool->GetNotes();
|
const QString notes = dialogTool->GetNotes();
|
||||||
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
||||||
|
@ -278,6 +295,8 @@ void VToolCurveIntersectAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObj
|
||||||
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
doc->SetAttribute(tag, AttrAngle, formulaAngle);
|
||||||
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
doc->SetAttribute(tag, AttrBasePoint, basePointId);
|
||||||
doc->SetAttribute(tag, AttrCurve, curveId);
|
doc->SetAttribute(tag, AttrCurve, curveId);
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrAlias1, m_aliasSuffix1, m_aliasSuffix1.isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrAlias2, m_aliasSuffix2, m_aliasSuffix2.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -285,11 +304,13 @@ void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
VToolLinePoint::ReadToolAttributes(domElement);
|
VToolLinePoint::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
m_lineType = doc->GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
m_lineType = VAbstractPattern::GetParametrString(domElement, AttrTypeLine, TypeLineLine);
|
||||||
lineColor = doc->GetParametrString(domElement, AttrLineColor, ColorBlack);
|
lineColor = VAbstractPattern::GetParametrString(domElement, AttrLineColor, ColorBlack);
|
||||||
basePointId = doc->GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
basePointId = VAbstractPattern::GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
|
||||||
curveId = doc->GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
curveId = VAbstractPattern::GetParametrUInt(domElement, AttrCurve, NULL_ID_STR);
|
||||||
formulaAngle = doc->GetParametrString(domElement, AttrAngle, QString());
|
formulaAngle = VAbstractPattern::GetParametrString(domElement, AttrAngle, QString());
|
||||||
|
m_aliasSuffix1 = VAbstractPattern::GetParametrEmptyString(domElement, AttrAlias1);
|
||||||
|
m_aliasSuffix2 = VAbstractPattern::GetParametrEmptyString(domElement, AttrAlias2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -297,7 +318,7 @@ void VToolCurveIntersectAxis::SetVisualization()
|
||||||
{
|
{
|
||||||
if (not vis.isNull())
|
if (not vis.isNull())
|
||||||
{
|
{
|
||||||
VisToolCurveIntersectAxis *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
auto *visual = qobject_cast<VisToolCurveIntersectAxis *>(vis);
|
||||||
SCASSERT(visual != nullptr)
|
SCASSERT(visual != nullptr)
|
||||||
|
|
||||||
visual->setObject1Id(curveId);
|
visual->setObject1Id(curveId);
|
||||||
|
@ -308,3 +329,34 @@ void VToolCurveIntersectAxis::SetVisualization()
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VToolCurveIntersectAxis::MakeToolTip() const
|
||||||
|
{
|
||||||
|
const QSharedPointer<VPointF> first = VAbstractTool::data.GeometricObject<VPointF>(basePointId);
|
||||||
|
const QSharedPointer<VPointF> second = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
||||||
|
|
||||||
|
const QLineF line(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
|
||||||
|
|
||||||
|
const QString toolTip = QString("<table>"
|
||||||
|
"<tr> <td><b>%6:</b> %7</td> </tr>"
|
||||||
|
"<tr> <td><b>%1:</b> %2 %3</td> </tr>"
|
||||||
|
"<tr> <td><b>%4:</b> %5°</td> </tr>"
|
||||||
|
"<tr> <td><b>%8:</b> %9</td> </tr>"
|
||||||
|
"<tr> <td><b>%10:</b> %11</td> </tr>"
|
||||||
|
"</table>")
|
||||||
|
.arg(tr("Length")) // 1
|
||||||
|
.arg(VAbstractValApplication::VApp()->fromPixel(line.length())) // 2
|
||||||
|
.arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true), tr("Angle")) // 3, 4
|
||||||
|
.arg(line.angle()) // 5
|
||||||
|
.arg(tr("Label"), second->name(), /* 6, 7 */
|
||||||
|
tr("Segment 1"), m_segments.first, /* 8, 9 */
|
||||||
|
tr("Segment 2"), m_segments.second); /* 10, 11 */
|
||||||
|
return toolTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolCurveIntersectAxis::SetSegments(const QPair<QString, QString> &segments)
|
||||||
|
{
|
||||||
|
m_segments = segments;
|
||||||
|
}
|
||||||
|
|
|
@ -48,16 +48,12 @@ template <class T> class QSharedPointer;
|
||||||
|
|
||||||
struct VToolCurveIntersectAxisInitData : VToolLinePointInitData
|
struct VToolCurveIntersectAxisInitData : VToolLinePointInitData
|
||||||
{
|
{
|
||||||
VToolCurveIntersectAxisInitData()
|
QString formulaAngle{'0'};
|
||||||
: VToolLinePointInitData(),
|
quint32 basePointId{NULL_ID};
|
||||||
formulaAngle('0'),
|
quint32 curveId{NULL_ID};
|
||||||
basePointId(NULL_ID),
|
QPair<QString, QString> segments{};
|
||||||
curveId(NULL_ID)
|
QString aliasSuffix1{};
|
||||||
{}
|
QString aliasSuffix2{};
|
||||||
|
|
||||||
QString formulaAngle;
|
|
||||||
quint32 basePointId;
|
|
||||||
quint32 curveId;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VToolCurveIntersectAxis : public VToolLinePoint
|
class VToolCurveIntersectAxis : public VToolLinePoint
|
||||||
|
@ -92,12 +88,18 @@ protected:
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
||||||
virtual void SetVisualization() override;
|
virtual void SetVisualization() override;
|
||||||
|
virtual auto MakeToolTip() const -> QString override;
|
||||||
|
|
||||||
|
void SetSegments(const QPair<QString, QString> &segments);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolCurveIntersectAxis)
|
Q_DISABLE_COPY(VToolCurveIntersectAxis)
|
||||||
QString formulaAngle;
|
QString formulaAngle;
|
||||||
quint32 curveId;
|
quint32 curveId;
|
||||||
|
QPair<QString, QString> m_segments{};
|
||||||
|
QString m_aliasSuffix1{};
|
||||||
|
QString m_aliasSuffix2{};
|
||||||
|
|
||||||
VToolCurveIntersectAxis(const VToolCurveIntersectAxisInitData &initData, QGraphicsItem *parent = nullptr);
|
explicit VToolCurveIntersectAxis(const VToolCurveIntersectAxisInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
|
|
||||||
template <class Item>
|
template <class Item>
|
||||||
static void InitArc(VContainer *data, qreal segLength, const VPointF *p, quint32 curveId);
|
static void InitArc(VContainer *data, qreal segLength, const VPointF *p, quint32 curveId);
|
||||||
|
|
|
@ -62,7 +62,13 @@ VToolPointOfIntersectionCurves::VToolPointOfIntersectionCurves(const VToolPointO
|
||||||
firstCurveId(initData.firstCurveId),
|
firstCurveId(initData.firstCurveId),
|
||||||
secondCurveId(initData.secondCurveId),
|
secondCurveId(initData.secondCurveId),
|
||||||
vCrossPoint(initData.vCrossPoint),
|
vCrossPoint(initData.vCrossPoint),
|
||||||
hCrossPoint(initData.hCrossPoint)
|
hCrossPoint(initData.hCrossPoint),
|
||||||
|
m_curve1Segments(initData.curve1Segments),
|
||||||
|
m_curve2Segments(initData.curve2Segments),
|
||||||
|
m_curve1AliasSuffix1(initData.curve1AliasSuffix1),
|
||||||
|
m_curve1AliasSuffix2(initData.curve1AliasSuffix2),
|
||||||
|
m_curve2AliasSuffix1(initData.curve2AliasSuffix1),
|
||||||
|
m_curve2AliasSuffix2(initData.curve2AliasSuffix2)
|
||||||
{
|
{
|
||||||
ToolCreation(initData.typeCreation);
|
ToolCreation(initData.typeCreation);
|
||||||
}
|
}
|
||||||
|
@ -80,6 +86,10 @@ void VToolPointOfIntersectionCurves::setDialog()
|
||||||
dialogTool->SetHCrossPoint(hCrossPoint);
|
dialogTool->SetHCrossPoint(hCrossPoint);
|
||||||
dialogTool->SetPointName(p->name());
|
dialogTool->SetPointName(p->name());
|
||||||
dialogTool->SetNotes(m_notes);
|
dialogTool->SetNotes(m_notes);
|
||||||
|
dialogTool->SetCurve1AliasSuffix1(m_curve1AliasSuffix1);
|
||||||
|
dialogTool->SetCurve1AliasSuffix2(m_curve1AliasSuffix2);
|
||||||
|
dialogTool->SetCurve2AliasSuffix1(m_curve2AliasSuffix1);
|
||||||
|
dialogTool->SetCurve2AliasSuffix2(m_curve2AliasSuffix2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -104,6 +114,10 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(const QPo
|
||||||
initData.parse = Document::FullParse;
|
initData.parse = Document::FullParse;
|
||||||
initData.typeCreation = Source::FromGui;
|
initData.typeCreation = Source::FromGui;
|
||||||
initData.notes = dialogTool->GetNotes();
|
initData.notes = dialogTool->GetNotes();
|
||||||
|
initData.curve1AliasSuffix1 = dialogTool->GetCurve1AliasSuffix1();
|
||||||
|
initData.curve1AliasSuffix2 = dialogTool->GetCurve1AliasSuffix2();
|
||||||
|
initData.curve2AliasSuffix1 = dialogTool->GetCurve2AliasSuffix1();
|
||||||
|
initData.curve2AliasSuffix2 = dialogTool->GetCurve2AliasSuffix2();
|
||||||
|
|
||||||
VToolPointOfIntersectionCurves *point = Create(initData);
|
VToolPointOfIntersectionCurves *point = Create(initData);
|
||||||
if (point != nullptr)
|
if (point != nullptr)
|
||||||
|
@ -141,19 +155,32 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(VToolPoin
|
||||||
{
|
{
|
||||||
initData.id = initData.data->AddGObject(p);
|
initData.id = initData.data->AddGObject(p);
|
||||||
|
|
||||||
VToolSinglePoint::InitSegments(curve1->getType(), segLength1, p, initData.firstCurveId, initData.data);
|
initData.curve1Segments = VToolSinglePoint::InitSegments(curve1->getType(), segLength1, p,
|
||||||
VToolSinglePoint::InitSegments(curve2->getType(), segLength2, p, initData.secondCurveId, initData.data);
|
initData.firstCurveId, initData.data,
|
||||||
|
initData.curve1AliasSuffix1,
|
||||||
|
initData.curve1AliasSuffix2);
|
||||||
|
initData.curve2Segments = VToolSinglePoint::InitSegments(curve2->getType(), segLength2, p,
|
||||||
|
initData.secondCurveId, initData.data,
|
||||||
|
initData.curve2AliasSuffix1,
|
||||||
|
initData.curve2AliasSuffix2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
initData.data->UpdateGObject(initData.id, p);
|
initData.data->UpdateGObject(initData.id, p);
|
||||||
|
|
||||||
VToolSinglePoint::InitSegments(curve1->getType(), segLength1, p, initData.firstCurveId, initData.data);
|
initData.curve1Segments = VToolSinglePoint::InitSegments(curve1->getType(), segLength1, p,
|
||||||
VToolSinglePoint::InitSegments(curve2->getType(), segLength2, p, initData.secondCurveId, initData.data);
|
initData.firstCurveId, initData.data,
|
||||||
|
initData.curve1AliasSuffix1,
|
||||||
|
initData.curve1AliasSuffix2);
|
||||||
|
initData.curve2Segments = VToolSinglePoint::InitSegments(curve2->getType(), segLength2, p,
|
||||||
|
initData.secondCurveId, initData.data,
|
||||||
|
initData.curve2AliasSuffix1,
|
||||||
|
initData.curve2AliasSuffix2);
|
||||||
|
|
||||||
if (initData.parse != Document::FullParse)
|
if (initData.parse != Document::FullParse)
|
||||||
{
|
{
|
||||||
initData.doc->UpdateToolData(initData.id, initData.data);
|
initData.doc->UpdateToolData(initData.id, initData.data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +195,11 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(VToolPoin
|
||||||
initData.doc->IncrementReferens(curve2->getIdTool());
|
initData.doc->IncrementReferens(curve2->getIdTool());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto *tool = qobject_cast<VToolPointOfIntersectionCurves *>(VAbstractPattern::getTool(initData.id));
|
||||||
|
tool->SetCurve1Segments(initData.curve1Segments);
|
||||||
|
tool->SetCurve2Segments(initData.curve2Segments);
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +399,7 @@ void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement, QList<q
|
||||||
QList<quint32> &newDependencies)
|
QList<quint32> &newDependencies)
|
||||||
{
|
{
|
||||||
SCASSERT(not m_dialog.isNull())
|
SCASSERT(not m_dialog.isNull())
|
||||||
auto dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(m_dialog);
|
auto *dialogTool = qobject_cast<DialogPointOfIntersectionCurves*>(m_dialog);
|
||||||
SCASSERT(dialogTool != nullptr)
|
SCASSERT(dialogTool != nullptr)
|
||||||
|
|
||||||
AddDependence(oldDependencies, firstCurveId);
|
AddDependence(oldDependencies, firstCurveId);
|
||||||
|
@ -380,6 +412,14 @@ void VToolPointOfIntersectionCurves::SaveDialog(QDomElement &domElement, QList<q
|
||||||
doc->SetAttribute(domElement, AttrCurve2, QString().setNum(dialogTool->GetSecondCurveId()));
|
doc->SetAttribute(domElement, AttrCurve2, QString().setNum(dialogTool->GetSecondCurveId()));
|
||||||
doc->SetAttribute(domElement, AttrVCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetVCrossPoint())));
|
doc->SetAttribute(domElement, AttrVCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetVCrossPoint())));
|
||||||
doc->SetAttribute(domElement, AttrHCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetHCrossPoint())));
|
doc->SetAttribute(domElement, AttrHCrossPoint, QString().setNum(static_cast<int>(dialogTool->GetHCrossPoint())));
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrCurve1Alias1, dialogTool->GetCurve1AliasSuffix1(),
|
||||||
|
dialogTool->GetCurve1AliasSuffix1().isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrCurve1Alias2, dialogTool->GetCurve1AliasSuffix2(),
|
||||||
|
dialogTool->GetCurve1AliasSuffix2().isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrCurve2Alias1, dialogTool->GetCurve2AliasSuffix1(),
|
||||||
|
dialogTool->GetCurve2AliasSuffix1().isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(domElement, AttrCurve2Alias2, dialogTool->GetCurve2AliasSuffix2(),
|
||||||
|
dialogTool->GetCurve2AliasSuffix2().isEmpty());
|
||||||
|
|
||||||
const QString notes = dialogTool->GetNotes();
|
const QString notes = dialogTool->GetNotes();
|
||||||
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
doc->SetAttributeOrRemoveIf(domElement, AttrNotes, notes, notes.isEmpty());
|
||||||
|
@ -395,6 +435,10 @@ void VToolPointOfIntersectionCurves::SaveOptions(QDomElement &tag, QSharedPointe
|
||||||
doc->SetAttribute(tag, AttrCurve2, secondCurveId);
|
doc->SetAttribute(tag, AttrCurve2, secondCurveId);
|
||||||
doc->SetAttribute(tag, AttrVCrossPoint, static_cast<int>(vCrossPoint));
|
doc->SetAttribute(tag, AttrVCrossPoint, static_cast<int>(vCrossPoint));
|
||||||
doc->SetAttribute(tag, AttrHCrossPoint, static_cast<int>(hCrossPoint));
|
doc->SetAttribute(tag, AttrHCrossPoint, static_cast<int>(hCrossPoint));
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrCurve1Alias1, m_curve1AliasSuffix1, m_curve1AliasSuffix1.isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrCurve1Alias2, m_curve1AliasSuffix2, m_curve1AliasSuffix2.isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrCurve2Alias1, m_curve2AliasSuffix1, m_curve2AliasSuffix1.isEmpty());
|
||||||
|
doc->SetAttributeOrRemoveIf(tag, AttrCurve2Alias2, m_curve2AliasSuffix2, m_curve2AliasSuffix2.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -402,10 +446,16 @@ void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domEl
|
||||||
{
|
{
|
||||||
VToolSinglePoint::ReadToolAttributes(domElement);
|
VToolSinglePoint::ReadToolAttributes(domElement);
|
||||||
|
|
||||||
firstCurveId = doc->GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
|
firstCurveId = VAbstractPattern::GetParametrUInt(domElement, AttrCurve1, NULL_ID_STR);
|
||||||
secondCurveId = doc->GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
|
secondCurveId = VAbstractPattern::GetParametrUInt(domElement, AttrCurve2, NULL_ID_STR);
|
||||||
vCrossPoint = static_cast<VCrossCurvesPoint>(doc->GetParametrUInt(domElement, AttrVCrossPoint, QChar('1')));
|
vCrossPoint = static_cast<VCrossCurvesPoint>(VAbstractPattern::GetParametrUInt(domElement, AttrVCrossPoint,
|
||||||
hCrossPoint = static_cast<HCrossCurvesPoint>(doc->GetParametrUInt(domElement, AttrHCrossPoint, QChar('1')));
|
QChar('1')));
|
||||||
|
hCrossPoint = static_cast<HCrossCurvesPoint>(VAbstractPattern::GetParametrUInt(domElement, AttrHCrossPoint,
|
||||||
|
QChar('1')));
|
||||||
|
m_curve1AliasSuffix1 = VAbstractPattern::GetParametrEmptyString(domElement, AttrCurve1Alias1);
|
||||||
|
m_curve1AliasSuffix2 = VAbstractPattern::GetParametrEmptyString(domElement, AttrCurve1Alias2);
|
||||||
|
m_curve2AliasSuffix1 = VAbstractPattern::GetParametrEmptyString(domElement, AttrCurve2Alias1);
|
||||||
|
m_curve2AliasSuffix2 = VAbstractPattern::GetParametrEmptyString(domElement, AttrCurve2Alias2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -423,3 +473,36 @@ void VToolPointOfIntersectionCurves::SetVisualization()
|
||||||
visual->RefreshGeometry();
|
visual->RefreshGeometry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VToolPointOfIntersectionCurves::MakeToolTip() const -> QString
|
||||||
|
{
|
||||||
|
const QSharedPointer<VPointF> p = VAbstractTool::data.GeometricObject<VPointF>(m_id);
|
||||||
|
|
||||||
|
const QString toolTip = QString("<table>"
|
||||||
|
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||||
|
"<tr> <td><b>%3:</b> %4</td> </tr>"
|
||||||
|
"<tr> <td><b>%5:</b> %6</td> </tr>"
|
||||||
|
"<tr> <td><b>%7:</b> %8</td> </tr>"
|
||||||
|
"<tr> <td><b>%9:</b> %10</td> </tr>"
|
||||||
|
"</table>")
|
||||||
|
.arg(tr("Label"), p->name(), /* 1, 2 */
|
||||||
|
tr("Curve 1 segment 1"), m_curve1Segments.first, /* 3, 4 */
|
||||||
|
tr("Curve 1 segment 2"), m_curve1Segments.second) /* 5, 6 */
|
||||||
|
.arg(tr("Curve 2 segment 1"), m_curve2Segments.first, /* 7, 8 */
|
||||||
|
tr("Curve 2 segment 2"), m_curve2Segments.second); /* 9, 10 */
|
||||||
|
|
||||||
|
return toolTip;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPointOfIntersectionCurves::SetCurve1Segments(const QPair<QString, QString> &segments)
|
||||||
|
{
|
||||||
|
m_curve1Segments = segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolPointOfIntersectionCurves::SetCurve2Segments(const QPair<QString, QString> &segments)
|
||||||
|
{
|
||||||
|
m_curve2Segments = segments;
|
||||||
|
}
|
||||||
|
|
|
@ -47,18 +47,16 @@ template <class T> class QSharedPointer;
|
||||||
|
|
||||||
struct VToolPointOfIntersectionCurvesInitData : VToolSinglePointInitData
|
struct VToolPointOfIntersectionCurvesInitData : VToolSinglePointInitData
|
||||||
{
|
{
|
||||||
VToolPointOfIntersectionCurvesInitData()
|
quint32 firstCurveId{NULL_ID};
|
||||||
: VToolSinglePointInitData(),
|
quint32 secondCurveId{NULL_ID};
|
||||||
firstCurveId(NULL_ID),
|
VCrossCurvesPoint vCrossPoint{VCrossCurvesPoint::HighestPoint};
|
||||||
secondCurveId(NULL_ID),
|
HCrossCurvesPoint hCrossPoint{HCrossCurvesPoint::LeftmostPoint};
|
||||||
vCrossPoint(VCrossCurvesPoint::HighestPoint),
|
QPair<QString, QString> curve1Segments{};
|
||||||
hCrossPoint(HCrossCurvesPoint::LeftmostPoint)
|
QPair<QString, QString> curve2Segments{};
|
||||||
{}
|
QString curve1AliasSuffix1{};
|
||||||
|
QString curve1AliasSuffix2{};
|
||||||
quint32 firstCurveId;
|
QString curve2AliasSuffix1{};
|
||||||
quint32 secondCurveId;
|
QString curve2AliasSuffix2{};
|
||||||
VCrossCurvesPoint vCrossPoint;
|
|
||||||
HCrossCurvesPoint hCrossPoint;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VToolPointOfIntersectionCurves : public VToolSinglePoint
|
class VToolPointOfIntersectionCurves : public VToolSinglePoint
|
||||||
|
@ -94,6 +92,10 @@ protected:
|
||||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
||||||
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
||||||
virtual void SetVisualization() override;
|
virtual void SetVisualization() override;
|
||||||
|
virtual auto MakeToolTip() const -> QString override;
|
||||||
|
|
||||||
|
void SetCurve1Segments(const QPair<QString, QString> &segments);
|
||||||
|
void SetCurve2Segments(const QPair<QString, QString> &segments);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolPointOfIntersectionCurves)
|
Q_DISABLE_COPY(VToolPointOfIntersectionCurves)
|
||||||
|
|
||||||
|
@ -103,6 +105,14 @@ private:
|
||||||
VCrossCurvesPoint vCrossPoint;
|
VCrossCurvesPoint vCrossPoint;
|
||||||
HCrossCurvesPoint hCrossPoint;
|
HCrossCurvesPoint hCrossPoint;
|
||||||
|
|
||||||
|
QPair<QString, QString> m_curve1Segments{};
|
||||||
|
QPair<QString, QString> m_curve2Segments{};
|
||||||
|
|
||||||
|
QString m_curve1AliasSuffix1{};
|
||||||
|
QString m_curve1AliasSuffix2{};
|
||||||
|
QString m_curve2AliasSuffix1{};
|
||||||
|
QString m_curve2AliasSuffix2{};
|
||||||
|
|
||||||
explicit VToolPointOfIntersectionCurves(const VToolPointOfIntersectionCurvesInitData &initData,
|
explicit VToolPointOfIntersectionCurves(const VToolPointOfIntersectionCurvesInitData &initData,
|
||||||
QGraphicsItem *parent = nullptr);
|
QGraphicsItem *parent = nullptr);
|
||||||
};
|
};
|
||||||
|
|
|
@ -395,17 +395,16 @@ void VToolSinglePoint::ToolSelectionType(const SelectionType &type)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
void VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId,
|
auto VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId,
|
||||||
VContainer *data)
|
VContainer *data, const QString &alias1,
|
||||||
|
const QString &alias2) -> QPair<QString, QString>
|
||||||
{
|
{
|
||||||
switch(curveType)
|
switch(curveType)
|
||||||
{
|
{
|
||||||
case GOType::EllipticalArc:
|
case GOType::EllipticalArc:
|
||||||
InitArc<VEllipticalArc>(data, segLength, p, curveId);
|
return InitArc<VEllipticalArc>(data, segLength, p, curveId, alias1, alias2);
|
||||||
break;
|
|
||||||
case GOType::Arc:
|
case GOType::Arc:
|
||||||
InitArc<VArc>(data, segLength, p, curveId);
|
return InitArc<VArc>(data, segLength, p, curveId, alias1, alias2);
|
||||||
break;
|
|
||||||
case GOType::CubicBezier:
|
case GOType::CubicBezier:
|
||||||
case GOType::Spline:
|
case GOType::Spline:
|
||||||
{
|
{
|
||||||
|
@ -444,12 +443,20 @@ void VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPo
|
||||||
delete spl2;
|
delete spl2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spline1->SetAliasSuffix(alias1);
|
||||||
|
spline2->SetAliasSuffix(alias2);
|
||||||
|
|
||||||
data->RegisterUniqueName(spline1);
|
data->RegisterUniqueName(spline1);
|
||||||
data->AddSpline(spline1, NULL_ID, p->id());
|
data->AddSpline(spline1, NULL_ID, p->id());
|
||||||
|
|
||||||
data->RegisterUniqueName(spline2);
|
data->RegisterUniqueName(spline2);
|
||||||
data->AddSpline(spline2, NULL_ID, p->id());
|
data->AddSpline(spline2, NULL_ID, p->id());
|
||||||
break;
|
|
||||||
|
// Because we don't store segments, but only data about them we must register the names manually
|
||||||
|
data->RegisterUniqueName(spline1);
|
||||||
|
data->RegisterUniqueName(spline2);
|
||||||
|
|
||||||
|
return qMakePair(spline1->ObjectName(), spline2->ObjectName());
|
||||||
}
|
}
|
||||||
case GOType::CubicBezierPath:
|
case GOType::CubicBezierPath:
|
||||||
case GOType::SplinePath:
|
case GOType::SplinePath:
|
||||||
|
@ -492,12 +499,20 @@ void VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPo
|
||||||
delete splPath2;
|
delete splPath2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
splP1->SetAliasSuffix(alias1);
|
||||||
|
splP2->SetAliasSuffix(alias2);
|
||||||
|
|
||||||
data->RegisterUniqueName(splP1);
|
data->RegisterUniqueName(splP1);
|
||||||
data->AddSpline(splP1, NULL_ID, p->id());
|
data->AddSpline(splP1, NULL_ID, p->id());
|
||||||
|
|
||||||
data->RegisterUniqueName(splP2);
|
data->RegisterUniqueName(splP2);
|
||||||
data->AddSpline(splP2, NULL_ID, p->id());
|
data->AddSpline(splP2, NULL_ID, p->id());
|
||||||
break;
|
|
||||||
|
// Because we don't store segments, but only data about them we must register the names manually
|
||||||
|
data->RegisterUniqueName(splP1);
|
||||||
|
data->RegisterUniqueName(splP2);
|
||||||
|
|
||||||
|
return qMakePair(splP1->ObjectName(), splP2->ObjectName());
|
||||||
}
|
}
|
||||||
case GOType::Point:
|
case GOType::Point:
|
||||||
case GOType::PlaceLabel:
|
case GOType::PlaceLabel:
|
||||||
|
@ -505,6 +520,8 @@ void VToolSinglePoint::InitSegments(GOType curveType, qreal segLength, const VPo
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
|
@ -108,15 +108,19 @@ protected:
|
||||||
virtual void ChangeLabelVisibility(quint32 id, bool visible) override;
|
virtual void ChangeLabelVisibility(quint32 id, bool visible) override;
|
||||||
|
|
||||||
template <class Item>
|
template <class Item>
|
||||||
static void InitArc(VContainer *data, qreal segLength, const VPointF *p, quint32 curveId);
|
static QPair<QString, QString> InitArc(VContainer *data, qreal segLength, const VPointF *p, quint32 curveId,
|
||||||
static void InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId, VContainer *data);
|
const QString &alias1, const QString &alias2);
|
||||||
|
static QPair<QString, QString> InitSegments(GOType curveType, qreal segLength, const VPointF *p, quint32 curveId,
|
||||||
|
VContainer *data, const QString &alias1, const QString &alias2);
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VToolSinglePoint)
|
Q_DISABLE_COPY(VToolSinglePoint)
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <class Item>
|
template <class Item>
|
||||||
inline void VToolSinglePoint::InitArc(VContainer *data, qreal segLength, const VPointF *p, quint32 curveId)
|
inline auto VToolSinglePoint::InitArc(VContainer *data, qreal segLength, const VPointF *p,
|
||||||
|
quint32 curveId, const QString &alias1,
|
||||||
|
const QString &alias2) -> QPair<QString, QString>
|
||||||
{
|
{
|
||||||
QSharedPointer<Item> a1;
|
QSharedPointer<Item> a1;
|
||||||
QSharedPointer<Item> a2;
|
QSharedPointer<Item> a2;
|
||||||
|
@ -138,6 +142,9 @@ inline void VToolSinglePoint::InitArc(VContainer *data, qreal segLength, const V
|
||||||
arc1.setId(p->id() + 1);
|
arc1.setId(p->id() + 1);
|
||||||
arc2.setId(p->id() + 2);
|
arc2.setId(p->id() + 2);
|
||||||
|
|
||||||
|
arc1.SetAliasSuffix(alias1);
|
||||||
|
arc2.SetAliasSuffix(alias2);
|
||||||
|
|
||||||
if (not VFuzzyComparePossibleNulls(segLength, -1))
|
if (not VFuzzyComparePossibleNulls(segLength, -1))
|
||||||
{
|
{
|
||||||
a1 = QSharedPointer<Item>(new Item(arc1));
|
a1 = QSharedPointer<Item>(new Item(arc1));
|
||||||
|
@ -155,6 +162,12 @@ inline void VToolSinglePoint::InitArc(VContainer *data, qreal segLength, const V
|
||||||
|
|
||||||
data->AddArc(a1, arc1.id(), p->id());
|
data->AddArc(a1, arc1.id(), p->id());
|
||||||
data->AddArc(a2, arc2.id(), p->id());
|
data->AddArc(a2, arc2.id(), p->id());
|
||||||
|
|
||||||
|
// Because we don't store segments, but only data about them we must register the names manually
|
||||||
|
data->RegisterUniqueName(a1);
|
||||||
|
data->RegisterUniqueName(a2);
|
||||||
|
|
||||||
|
return qMakePair(arc1.ObjectName(), arc2.ObjectName());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // VTOOLSINGLEPOINT_H
|
#endif // VTOOLSINGLEPOINT_H
|
||||||
|
|
|
@ -713,6 +713,13 @@ void VToolSeamAllowance::UpdatePatternInfo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::UpdatePassmarks()
|
||||||
|
{
|
||||||
|
const VPiece detail = VAbstractTool::data.GetPiece(m_id);
|
||||||
|
m_passmarks->setPath(detail.PassmarksPath(getData()));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief VToolDetail::UpdateGrainline updates the grain line item
|
* @brief VToolDetail::UpdateGrainline updates the grain line item
|
||||||
|
@ -1296,6 +1303,7 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat
|
||||||
connect(this, &VToolSeamAllowance::ChoosedTool, m_sceneDetails, &VMainGraphicsScene::ChoosedItem);
|
connect(this, &VToolSeamAllowance::ChoosedTool, m_sceneDetails, &VMainGraphicsScene::ChoosedItem);
|
||||||
connect(m_sceneDetails, &VMainGraphicsScene::EnableToolMove, this, &VToolSeamAllowance::EnableToolMove);
|
connect(m_sceneDetails, &VMainGraphicsScene::EnableToolMove, this, &VToolSeamAllowance::EnableToolMove);
|
||||||
connect(m_sceneDetails, &VMainGraphicsScene::ItemSelection, this, &VToolSeamAllowance::ToolSelectionType);
|
connect(m_sceneDetails, &VMainGraphicsScene::ItemSelection, this, &VToolSeamAllowance::ToolSelectionType);
|
||||||
|
connect(m_sceneDetails, &VMainGraphicsScene::UpdatePassmarks, this, &VToolSeamAllowance::UpdatePassmarks);
|
||||||
|
|
||||||
ConnectOutsideSignals();
|
ConnectOutsideSignals();
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ public slots:
|
||||||
void Highlight(quint32 id);
|
void Highlight(quint32 id);
|
||||||
void UpdateDetailLabel();
|
void UpdateDetailLabel();
|
||||||
void UpdatePatternInfo();
|
void UpdatePatternInfo();
|
||||||
|
void UpdatePassmarks();
|
||||||
void ShowOptions();
|
void ShowOptions();
|
||||||
void DeleteFromMenu();
|
void DeleteFromMenu();
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
|
@ -319,6 +319,12 @@ void VMainGraphicsScene::HighlightItem(quint32 id)
|
||||||
emit HighlightDetail(id);
|
emit HighlightDetail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VMainGraphicsScene::UpdatePiecePassmarks()
|
||||||
|
{
|
||||||
|
emit UpdatePassmarks();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VMainGraphicsScene::ToggleLabelSelection(bool enabled)
|
void VMainGraphicsScene::ToggleLabelSelection(bool enabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,7 @@ public slots:
|
||||||
void EnableDetailsMode(bool mode);
|
void EnableDetailsMode(bool mode);
|
||||||
void ItemsSelection(const SelectionType &type);
|
void ItemsSelection(const SelectionType &type);
|
||||||
void HighlightItem(quint32 id);
|
void HighlightItem(quint32 id);
|
||||||
|
void UpdatePiecePassmarks();
|
||||||
|
|
||||||
void ToggleLabelSelection(bool enabled);
|
void ToggleLabelSelection(bool enabled);
|
||||||
void TogglePointSelection(bool enabled);
|
void TogglePointSelection(bool enabled);
|
||||||
|
@ -123,6 +124,7 @@ signals:
|
||||||
void CurveDetailsMode(bool mode);
|
void CurveDetailsMode(bool mode);
|
||||||
void ItemSelection(const SelectionType &type);
|
void ItemSelection(const SelectionType &type);
|
||||||
void HighlightDetail(quint32 id);
|
void HighlightDetail(quint32 id);
|
||||||
|
void UpdatePassmarks();
|
||||||
|
|
||||||
void EnableLabelItemSelection(bool enable);
|
void EnableLabelItemSelection(bool enable);
|
||||||
void EnablePointItemSelection(bool enable);
|
void EnablePointItemSelection(bool enable);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += testlib widgets printsupport concurrent xml
|
QT += testlib widgets printsupport concurrent xml xmlpatterns
|
||||||
|
|
||||||
QT -= gui
|
QT -= gui
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += testlib widgets xml printsupport
|
QT += testlib widgets xml printsupport concurrent xmlpatterns
|
||||||
|
|
||||||
QT -= gui
|
QT -= gui
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user