2013-07-13 12:51:31 +02:00
|
|
|
|
#include "vcontainer.h"
|
2013-08-20 12:26:02 +02:00
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
|
#pragma GCC diagnostic ignored "-Weffc++"
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wconversion"
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
|
|
|
|
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
|
2013-07-13 12:51:31 +02:00
|
|
|
|
#include <QDebug>
|
2013-08-20 12:26:02 +02:00
|
|
|
|
#pragma GCC diagnostic pop
|
2013-07-17 13:38:11 +02:00
|
|
|
|
#include "../options.h"
|
|
|
|
|
|
2013-08-15 22:39:00 +02:00
|
|
|
|
qint64 VContainer::_id = 0;
|
|
|
|
|
|
2013-08-20 12:26:02 +02:00
|
|
|
|
VContainer::VContainer():base(QMap<QString, qint32>()), points(QMap<qint64, VPointF>()),
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingPoints(QMap<qint64, VPointF>()),
|
2013-08-20 12:26:02 +02:00
|
|
|
|
standartTable(QMap<QString, VStandartTableCell>()), incrementTable(QMap<QString, VIncrementTableRow>()),
|
2013-08-21 10:03:53 +02:00
|
|
|
|
lengthLines(QMap<QString, qreal>()), lineAngles(QMap<QString, qreal>()), splines(QMap<qint64, VSpline>()),
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingSplines(QMap<qint64, VSpline>()),
|
|
|
|
|
lengthSplines(QMap<QString, qreal>()), arcs(QMap<qint64, VArc>()), modelingArcs(QMap<qint64, VArc>()),
|
|
|
|
|
lengthArcs(QMap<QString, qreal>()),
|
|
|
|
|
splinePaths(QMap<qint64, VSplinePath>()), modelingSplinePaths(QMap<qint64, VSplinePath>()),
|
|
|
|
|
details(QMap<qint64, VDetail>()){
|
2013-07-17 13:38:11 +02:00
|
|
|
|
SetSize(500);
|
|
|
|
|
SetGrowth(1760);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
CreateManTableIGroup ();
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 22:39:00 +02:00
|
|
|
|
const VContainer &VContainer::operator =(const VContainer &data){
|
|
|
|
|
setData(data);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::setData(const VContainer &data){
|
|
|
|
|
base = *data.DataBase();
|
|
|
|
|
points = *data.DataPoints();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingPoints = *data.DataModelingPoints();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
standartTable = *data.DataStandartTable();
|
|
|
|
|
incrementTable = *data.DataIncrementTable();
|
|
|
|
|
lengthLines = *data.DataLengthLines();
|
2013-08-21 10:03:53 +02:00
|
|
|
|
lineAngles = *data.DataLengthArcs();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
splines = *data.DataSplines();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingSplines = *data.DataModelingSplines();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
lengthSplines = *data.DataLengthSplines();
|
|
|
|
|
arcs = *data.DataArcs();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingArcs = *data.DataModelingArcs();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
lengthArcs = *data.DataLengthArcs();
|
|
|
|
|
splinePaths = *data.DataSplinePaths();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
modelingSplinePaths = *data.DataModelingSplinePaths();
|
|
|
|
|
details = *data.DataDetails();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
template <typename key, typename val>
|
|
|
|
|
val VContainer::GetObject(const QMap<key,val> &obj, key id)const{
|
|
|
|
|
if(obj.contains(id)){
|
|
|
|
|
return obj.value(id);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
} else {
|
2013-08-13 18:48:36 +02:00
|
|
|
|
qCritical()<<"Не можу знайти key = "<<id<<" в таблиці.";
|
|
|
|
|
throw"Не можу знайти об'єкт за ключем.";
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
2013-08-13 18:48:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VPointF VContainer::GetPoint(qint64 id) const{
|
|
|
|
|
return GetObject(points, id);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
VPointF VContainer::GetModelingPoint(qint64 id) const{
|
|
|
|
|
return GetObject(modelingPoints, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
VStandartTableCell VContainer::GetStandartTableCell(const QString &name) const{
|
2013-08-13 18:48:36 +02:00
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
|
|
|
|
return GetObject(standartTable, name);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const{
|
2013-08-13 18:48:36 +02:00
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
|
|
|
|
return GetObject(incrementTable, name);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
qreal VContainer::GetLine(const QString &name) const{
|
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
|
|
|
|
return GetObject(lengthLines, name);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-20 12:26:02 +02:00
|
|
|
|
qreal VContainer::GetLineArc(const QString &name) const{
|
2013-08-13 18:48:36 +02:00
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
2013-08-21 10:03:53 +02:00
|
|
|
|
return GetObject(lineAngles, name);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VSpline VContainer::GetSpline(qint64 id) const{
|
|
|
|
|
return GetObject(splines, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
VSpline VContainer::GetModelingSpline(qint64 id) const{
|
|
|
|
|
return GetObject(modelingSplines, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
VArc VContainer::GetArc(qint64 id) const{
|
|
|
|
|
return GetObject(arcs, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
VArc VContainer::GetModelingArc(qint64 id) const{
|
|
|
|
|
return GetObject(modelingArcs, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
VSplinePath VContainer::GetSplinePath(qint64 id) const{
|
|
|
|
|
return GetObject(splinePaths, id);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
VSplinePath VContainer::GetModelingSplinePath(qint64 id) const{
|
|
|
|
|
return GetObject(modelingSplinePaths, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VDetail VContainer::GetDetail(qint64 id) const{
|
|
|
|
|
return GetObject(details, id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
void VContainer::AddStandartTableCell(const QString& name, const VStandartTableCell& cell){
|
|
|
|
|
standartTable[name] = cell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::AddIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
|
|
|
|
|
incrementTable[name] = cell;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
qint64 VContainer::getId(){
|
|
|
|
|
return _id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 VContainer::getNextId(){
|
|
|
|
|
++_id;
|
|
|
|
|
return _id;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
void VContainer::UpdateId(qint64 newId){
|
|
|
|
|
if(newId > _id){
|
|
|
|
|
_id = newId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
void VContainer::IncrementReferens(qint64 id, Scene::Type obj){
|
|
|
|
|
switch( obj ){
|
|
|
|
|
case(Scene::Line):
|
|
|
|
|
break;
|
|
|
|
|
case(Scene::Point):{
|
|
|
|
|
VPointF point = GetPoint(id);
|
|
|
|
|
point.incrementReferens();
|
|
|
|
|
UpdatePoint(id, point);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case(Scene::Arc):{
|
|
|
|
|
VArc arc = GetArc(id);
|
|
|
|
|
arc.incrementReferens();
|
|
|
|
|
UpdateArc(id, arc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case(Scene::Spline):{
|
|
|
|
|
VSpline spl = GetSpline(id);
|
|
|
|
|
spl.incrementReferens();
|
|
|
|
|
UpdateSpline(id, spl);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case(Scene::SplinePath):{
|
|
|
|
|
VSplinePath splPath = GetSplinePath(id);
|
|
|
|
|
splPath.incrementReferens();
|
|
|
|
|
UpdateSplinePath(id, splPath);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
void VContainer::RemoveIncrementTableRow(const QString& name){
|
|
|
|
|
incrementTable.remove(name);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
template <typename val>
|
|
|
|
|
void VContainer::UpdateObject(QMap<qint64, val> &obj, const qint64 &id, const val& point){
|
|
|
|
|
obj[id] = point;
|
|
|
|
|
UpdateId(id);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
void VContainer::UpdatePoint(qint64 id, const VPointF& point){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
UpdateObject(points, id, point);
|
2013-07-13 12:51:31 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
void VContainer::UpdateModelingPoint(qint64 id, const VPointF &point){
|
|
|
|
|
UpdateObject(modelingPoints, id, point);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::UpdateDetail(qint64 id, const VDetail &detail){
|
|
|
|
|
UpdateObject(details, id, detail);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
void VContainer::UpdateSpline(qint64 id, const VSpline &spl){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
UpdateObject(splines, id, spl);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
void VContainer::UpdateModelingSpline(qint64 id, const VSpline &spl){
|
|
|
|
|
UpdateObject(modelingSplines, id, spl);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
|
void VContainer::UpdateSplinePath(qint64 id, const VSplinePath &splPath){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
UpdateObject(splinePaths, id, splPath);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
void VContainer::UpdateModelingSplinePath(qint64 id, const VSplinePath &splPath){
|
|
|
|
|
UpdateObject(modelingSplinePaths, id, splPath);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
void VContainer::UpdateArc(qint64 id, const VArc &arc){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
UpdateObject(arcs, id, arc);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
void VContainer::UpdateModelingArc(qint64 id, const VArc &arc){
|
|
|
|
|
UpdateObject(modelingArcs, id, arc);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
void VContainer::UpdateStandartTableCell(const QString& name, const VStandartTableCell& cell){
|
|
|
|
|
standartTable[name] = cell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::UpdateIncrementTableRow(const QString& name, const VIncrementTableRow& cell){
|
|
|
|
|
incrementTable[name] = cell;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
void VContainer::AddLengthSpline(const QString &name, const qreal &value){
|
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
|
|
|
|
lengthSplines[name] = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::AddLengthArc(const qint64 ¢er, const qint64 &id){
|
|
|
|
|
AddLengthArc(GetNameArc(center, id), GetArc(id).GetLength());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::AddLengthArc(const QString &name, const qreal &value){
|
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
|
|
|
|
lengthArcs[name] = value;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 10:03:53 +02:00
|
|
|
|
void VContainer::AddLineAngle(const QString &name, const qreal &value){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
2013-08-21 10:03:53 +02:00
|
|
|
|
lineAngles[name] = value;
|
2013-08-13 18:48:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
qreal VContainer::GetValueStandartTableCell(const QString& name) const{
|
|
|
|
|
VStandartTableCell cell = GetStandartTableCell(name);
|
2013-08-20 12:26:02 +02:00
|
|
|
|
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
|
|
|
|
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
2013-07-17 13:38:11 +02:00
|
|
|
|
qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth();
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal VContainer::GetValueIncrementTableRow(const QString& name) const{
|
|
|
|
|
VIncrementTableRow cell = GetIncrementTableRow(name);
|
2013-08-20 12:26:02 +02:00
|
|
|
|
qreal k_size = ( static_cast<qreal> (size()/10.0) - 50.0 ) / 2.0;
|
|
|
|
|
qreal k_growth = ( static_cast<qreal> (growth()/10.0) - 176.0 ) / 6.0;
|
2013-07-17 13:38:11 +02:00
|
|
|
|
qreal value = cell.getBase() + k_size*cell.getKsize() + k_growth*cell.getKgrowth();
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-13 12:51:31 +02:00
|
|
|
|
void VContainer::Clear(){
|
|
|
|
|
_id = 0;
|
2013-07-17 13:38:11 +02:00
|
|
|
|
standartTable.clear();
|
|
|
|
|
incrementTable.clear();
|
2013-07-25 14:00:51 +02:00
|
|
|
|
lengthLines.clear();
|
2013-08-05 10:37:56 +02:00
|
|
|
|
lengthArcs.clear();
|
2013-08-21 10:03:53 +02:00
|
|
|
|
lineAngles.clear();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
details.clear();
|
|
|
|
|
modelingArcs.clear();
|
|
|
|
|
modelingPoints.clear();
|
|
|
|
|
modelingSplinePaths.clear();
|
|
|
|
|
modelingSplines.clear();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
ClearObject();
|
2013-08-13 18:48:36 +02:00
|
|
|
|
CreateManTableIGroup ();
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 22:39:00 +02:00
|
|
|
|
void VContainer::ClearObject(){
|
|
|
|
|
points.clear();
|
|
|
|
|
splines.clear();
|
|
|
|
|
arcs.clear();
|
2013-08-28 10:55:11 +02:00
|
|
|
|
splinePaths.clear();
|
2013-08-15 22:39:00 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
void VContainer::ClearIncrementTable(){
|
|
|
|
|
incrementTable.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
void VContainer::ClearLengthLines(){
|
|
|
|
|
lengthLines.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
void VContainer::ClearLengthSplines(){
|
|
|
|
|
lengthSplines.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::ClearLengthArcs(){
|
|
|
|
|
lengthArcs.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 10:03:53 +02:00
|
|
|
|
void VContainer::ClearLineAngles(){
|
|
|
|
|
lineAngles.clear();
|
2013-08-06 09:56:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-07-17 13:38:11 +02:00
|
|
|
|
void VContainer::SetSize(qint32 size){
|
|
|
|
|
base["Сг"] = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::SetGrowth(qint32 growth){
|
|
|
|
|
base["Р"] = growth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint32 VContainer::size() const{
|
|
|
|
|
return base.value("Сг");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint32 VContainer::growth() const{
|
|
|
|
|
return base.value("Р");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool VContainer::IncrementTableContains(const QString& name){
|
|
|
|
|
return incrementTable.contains(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal VContainer::FindVar(const QString &name, bool *ok)const{
|
|
|
|
|
if(base.contains(name)){
|
|
|
|
|
*ok = true;
|
2013-07-25 14:00:51 +02:00
|
|
|
|
return base.value(name);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(standartTable.contains(name)){
|
|
|
|
|
*ok = true;
|
2013-07-25 14:00:51 +02:00
|
|
|
|
return GetValueStandartTableCell(name);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
if(incrementTable.contains(name)){
|
|
|
|
|
*ok = true;
|
2013-07-25 14:00:51 +02:00
|
|
|
|
return GetValueIncrementTableRow(name);
|
|
|
|
|
}
|
|
|
|
|
if(lengthLines.contains(name)){
|
|
|
|
|
*ok = true;
|
|
|
|
|
return lengthLines.value(name);
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
2013-08-06 09:56:09 +02:00
|
|
|
|
if(lengthArcs.contains(name)){
|
|
|
|
|
*ok = true;
|
|
|
|
|
return lengthArcs.value(name);
|
|
|
|
|
}
|
2013-08-21 10:03:53 +02:00
|
|
|
|
if(lineAngles.contains(name)){
|
2013-08-06 09:56:09 +02:00
|
|
|
|
*ok = true;
|
2013-08-21 10:03:53 +02:00
|
|
|
|
return lineAngles.value(name);
|
2013-08-06 09:56:09 +02:00
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
*ok = false;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
const QMap<qint64, VPointF> *VContainer::DataPoints() const{
|
|
|
|
|
return &points;
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
const QMap<qint64, VPointF> *VContainer::DataModelingPoints() const{
|
|
|
|
|
return &modelingPoints;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
const QMap<qint64, VSpline> *VContainer::DataSplines() const{
|
|
|
|
|
return &splines;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
const QMap<qint64, VSpline> *VContainer::DataModelingSplines() const{
|
|
|
|
|
return &modelingSplines;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
const QMap<qint64, VArc> *VContainer::DataArcs() const{
|
|
|
|
|
return &arcs;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
const QMap<qint64, VArc> *VContainer::DataModelingArcs() const{
|
|
|
|
|
return &modelingArcs;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
const QMap<QString, qint32> *VContainer::DataBase() const{
|
|
|
|
|
return &base;
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
const QMap<QString, VStandartTableCell> *VContainer::DataStandartTable() const{
|
|
|
|
|
return &standartTable;
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
const QMap<QString, VIncrementTableRow> *VContainer::DataIncrementTable() const{
|
|
|
|
|
return &incrementTable;
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
2013-07-25 14:00:51 +02:00
|
|
|
|
const QMap<QString, qreal> *VContainer::DataLengthLines() const{
|
|
|
|
|
return &lengthLines;
|
|
|
|
|
}
|
2013-07-17 13:38:11 +02:00
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
const QMap<QString, qreal> *VContainer::DataLengthSplines() const{
|
|
|
|
|
return &lengthSplines;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
const QMap<QString, qreal> *VContainer::DataLengthArcs() const{
|
|
|
|
|
return &lengthArcs;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 10:03:53 +02:00
|
|
|
|
const QMap<QString, qreal> *VContainer::DataLineAngles() const{
|
|
|
|
|
return &lineAngles;
|
2013-08-13 18:48:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QMap<qint64, VSplinePath> *VContainer::DataSplinePaths() const{
|
|
|
|
|
return &splinePaths;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
const QMap<qint64, VSplinePath> *VContainer::DataModelingSplinePaths() const{
|
|
|
|
|
return &modelingSplinePaths;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QMap<qint64, VDetail> *VContainer::DataDetails() const{
|
|
|
|
|
return &details;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-30 15:09:34 +02:00
|
|
|
|
void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId){
|
|
|
|
|
QString nameLine = GetNameLine(firstPointId, secondPointId);
|
|
|
|
|
VPointF firstPoint = GetPoint(firstPointId);
|
|
|
|
|
VPointF secondPoint = GetPoint(secondPointId);
|
2013-08-13 18:48:36 +02:00
|
|
|
|
AddLengthLine(nameLine, QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()).length()/PrintDPI*25.4);
|
2013-08-21 10:03:53 +02:00
|
|
|
|
nameLine = GetNameLineAngle(firstPointId, secondPointId);
|
|
|
|
|
AddLineAngle(nameLine, QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()).angle());
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
template <typename key, typename val>
|
|
|
|
|
qint64 VContainer::AddObject(QMap<key, val> &obj, const val& value){
|
2013-08-05 10:37:56 +02:00
|
|
|
|
qint64 id = getNextId();
|
2013-08-13 18:48:36 +02:00
|
|
|
|
obj[id] = value;
|
2013-08-05 10:37:56 +02:00
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
qint64 VContainer::AddPoint(const VPointF& point){
|
|
|
|
|
return AddObject(points, point);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
qint64 VContainer::AddModelingPoint(const VPointF &point){
|
|
|
|
|
return AddObject(modelingPoints, point);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 VContainer::AddDetail(const VDetail &detail){
|
|
|
|
|
return AddObject(details, detail);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
qint64 VContainer::AddSpline(const VSpline &spl){
|
|
|
|
|
return AddObject(splines, spl);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
qint64 VContainer::AddModelingSpline(const VSpline &spl){
|
|
|
|
|
return AddObject(modelingSplines, spl);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
|
qint64 VContainer::AddSplinePath(const VSplinePath &splPath){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
return AddObject(splinePaths, splPath);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
qint64 VContainer::AddModelingSplinePath(const VSplinePath &splPath){
|
|
|
|
|
return AddObject(modelingSplinePaths, splPath);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
qint64 VContainer::AddArc(const VArc &arc){
|
2013-08-13 18:48:36 +02:00
|
|
|
|
return AddObject(arcs, arc);
|
2013-07-30 15:09:34 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-28 10:55:11 +02:00
|
|
|
|
qint64 VContainer::AddModelingArc(const VArc &arc){
|
|
|
|
|
return AddObject(modelingArcs, arc);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-30 15:09:34 +02:00
|
|
|
|
QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const{
|
|
|
|
|
VPointF first = GetPoint(firstPoint);
|
|
|
|
|
VPointF second = GetPoint(secondPoint);
|
|
|
|
|
return QString("Line_%1_%2").arg(first.name(), second.name());
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 10:03:53 +02:00
|
|
|
|
QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const{
|
2013-08-05 10:37:56 +02:00
|
|
|
|
VPointF first = GetPoint(firstPoint);
|
|
|
|
|
VPointF second = GetPoint(secondPoint);
|
2013-08-21 10:03:53 +02:00
|
|
|
|
return QString("AngleLine_%1_%2").arg(first.name(), second.name());
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-06 09:56:09 +02:00
|
|
|
|
QString VContainer::GetNameSpline(const qint64 &firstPoint, const qint64 &secondPoint) const{
|
2013-08-05 10:37:56 +02:00
|
|
|
|
VPointF first = GetPoint(firstPoint);
|
|
|
|
|
VPointF second = GetPoint(secondPoint);
|
2013-08-06 09:56:09 +02:00
|
|
|
|
return QString("Spl_%1_%2").arg(first.name(), second.name());
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
|
QString VContainer::GetNameSplinePath(const VSplinePath &path) const{
|
|
|
|
|
if(path.Count() == 0){
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
QString name("SplPath");
|
|
|
|
|
for(qint32 i = 1; i <= path.Count(); ++i){
|
|
|
|
|
VSpline spl = path.GetSpline(i);
|
|
|
|
|
VPointF first = GetPoint(spl.GetP1());
|
|
|
|
|
VPointF second = GetPoint(spl.GetP4());
|
|
|
|
|
QString splName = QString("_%1_%2").arg(first.name(), second.name());
|
|
|
|
|
name.append(splName);
|
|
|
|
|
}
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-06 09:56:09 +02:00
|
|
|
|
QString VContainer::GetNameArc(const qint64 ¢er, const qint64 &id) const{
|
|
|
|
|
VPointF centerPoint = GetPoint(center);
|
2013-08-20 12:26:02 +02:00
|
|
|
|
return QString ("Arc(%1)%2").arg(centerPoint.name()).arg(id);
|
2013-08-05 10:37:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VContainer::AddLengthLine(const QString &name, const qreal &value){
|
2013-07-25 14:00:51 +02:00
|
|
|
|
Q_ASSERT(!name.isEmpty());
|
2013-08-06 09:56:09 +02:00
|
|
|
|
lengthLines[name] = value;
|
2013-07-17 13:38:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
|
void VContainer::AddLengthSpline(const qint64 &firstPointId, const qint64 &secondPointId){
|
|
|
|
|
QString nameLine = GetNameSpline(firstPointId, secondPointId);
|
|
|
|
|
VPointF firstPoint = GetPoint(firstPointId);
|
|
|
|
|
VPointF secondPoint = GetPoint(secondPointId);
|
|
|
|
|
AddLengthSpline(nameLine, QLineF(firstPoint.toQPointF(), secondPoint.toQPointF()).length());
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-13 18:48:36 +02:00
|
|
|
|
void VContainer::CreateManTableIGroup (){
|
|
|
|
|
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
|
|
|
|
|
AddStandartTableCell("Pkor", VStandartTableCell(84, 0, 3));
|
|
|
|
|
AddStandartTableCell("Vtos", VStandartTableCell(1450, 2, 51));
|
|
|
|
|
AddStandartTableCell("Vtosh", VStandartTableCell(1506, 2, 54));
|
|
|
|
|
AddStandartTableCell("Vpt", VStandartTableCell(1438, 3, 52));
|
|
|
|
|
AddStandartTableCell("Vst", VStandartTableCell(1257, -1, 49));
|
|
|
|
|
AddStandartTableCell("Vlt", VStandartTableCell(1102, 0, 43));
|
|
|
|
|
AddStandartTableCell("Vk", VStandartTableCell(503, 0, 22));
|
|
|
|
|
AddStandartTableCell("Vsht", VStandartTableCell(1522, 2, 54));
|
|
|
|
|
AddStandartTableCell("Vzy", VStandartTableCell(1328, 0, 49));
|
|
|
|
|
AddStandartTableCell("Vlop", VStandartTableCell(1320, 0, 49));
|
|
|
|
|
AddStandartTableCell("Vps", VStandartTableCell(811, -1, 36));
|
|
|
|
|
AddStandartTableCell("Osh", VStandartTableCell(404,8, 2));
|
|
|
|
|
AddStandartTableCell("OgI", VStandartTableCell(1034, 36, 4));
|
|
|
|
|
AddStandartTableCell("OgII", VStandartTableCell(1044, 38, 2));
|
|
|
|
|
AddStandartTableCell("OgIII", VStandartTableCell(1000, 40, 0));
|
|
|
|
|
AddStandartTableCell("Ot", VStandartTableCell(780, 40, 0));
|
|
|
|
|
AddStandartTableCell("Ob", VStandartTableCell(984, 30, 10));
|
|
|
|
|
AddStandartTableCell("ObI", VStandartTableCell(964, 24, 12));
|
|
|
|
|
AddStandartTableCell("Obed", VStandartTableCell(566, 18, 6));
|
|
|
|
|
AddStandartTableCell("Ok", VStandartTableCell(386, 8, 8));
|
|
|
|
|
AddStandartTableCell("Oi", VStandartTableCell(380, 8, 6));
|
|
|
|
|
AddStandartTableCell("Osch", VStandartTableCell(234, 4, 4));
|
|
|
|
|
AddStandartTableCell("Os", VStandartTableCell(350, 2, 8));
|
|
|
|
|
AddStandartTableCell("Dsb", VStandartTableCell(1120, 0, 44));
|
|
|
|
|
AddStandartTableCell("Dsp", VStandartTableCell(1110, 0, 43));
|
|
|
|
|
AddStandartTableCell("Dn", VStandartTableCell(826, -3, 37));
|
|
|
|
|
AddStandartTableCell("Dps", VStandartTableCell(316, 4, 7));
|
|
|
|
|
AddStandartTableCell("Dpob", VStandartTableCell(783, 14, 15));
|
|
|
|
|
AddStandartTableCell("Ds", VStandartTableCell(260, 1, 6));
|
|
|
|
|
AddStandartTableCell("Op", VStandartTableCell(316, 12, 0));
|
|
|
|
|
AddStandartTableCell("Ozap", VStandartTableCell(180, 4, 0));
|
|
|
|
|
AddStandartTableCell("Pkis", VStandartTableCell(250, 4, 0));
|
|
|
|
|
AddStandartTableCell("SHp", VStandartTableCell(160, 1, 4));
|
|
|
|
|
AddStandartTableCell("Dlych", VStandartTableCell(500, 2, 15));
|
|
|
|
|
AddStandartTableCell("Dzap", VStandartTableCell(768, 2, 24));
|
|
|
|
|
AddStandartTableCell("DIIIp", VStandartTableCell(970, 2, 29));
|
|
|
|
|
AddStandartTableCell("Vprp", VStandartTableCell(214, 3, 3));
|
|
|
|
|
AddStandartTableCell("Vg", VStandartTableCell(262, 8, 3));
|
|
|
|
|
AddStandartTableCell("Dtp", VStandartTableCell(460, 7, 9));
|
|
|
|
|
AddStandartTableCell("Dp", VStandartTableCell(355, 5, 5));
|
|
|
|
|
AddStandartTableCell("Vprz", VStandartTableCell(208, 3, 5));
|
|
|
|
|
AddStandartTableCell("Dts", VStandartTableCell(438, 2, 10));
|
|
|
|
|
AddStandartTableCell("DtsI", VStandartTableCell(469, 2, 10));
|
|
|
|
|
AddStandartTableCell("Dvcht", VStandartTableCell(929, 9, 19));
|
|
|
|
|
AddStandartTableCell("SHg", VStandartTableCell(370, 14, 4));
|
|
|
|
|
AddStandartTableCell("Cg", VStandartTableCell(224, 6, 0));
|
|
|
|
|
AddStandartTableCell("SHs", VStandartTableCell(416, 10, 2));
|
|
|
|
|
AddStandartTableCell("dpzr", VStandartTableCell(121, 6, 0));
|
|
|
|
|
AddStandartTableCell("Ogol", VStandartTableCell(576, 4, 4));
|
|
|
|
|
AddStandartTableCell("Ssh1", VStandartTableCell(205, 5, 0));
|
|
|
|
|
AddStandartTableCell("St", VStandartTableCell(410, 20, 0));
|
|
|
|
|
AddStandartTableCell("Drzap", VStandartTableCell(594, 3, 19));
|
|
|
|
|
AddStandartTableCell("DbII", VStandartTableCell(1020, 0, 44));
|
|
|
|
|
AddStandartTableCell("Sb", VStandartTableCell(504, 15, 4));
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|